@iotize/ionic
Version:
Iotize specific building blocks on top of @ionic/angular.
64 lines (63 loc) • 2.47 kB
TypeScript
import { ProgressState } from '@iotize/common/progress/api';
import { Observable } from 'rxjs';
import { TapInfoHolder, TapInfoKey, TapInfoKeyObjectOrString } from './definitions';
import { TapInfoCacheService } from './tap-info-cache.service';
import * as i0 from "@angular/core";
export type RefreshKeysProgressState = ProgressState & {};
export declare class TapInfoRequestService {
private tapInfoCacheService;
/**
* Tap info keys to load queue
*/
private readonly queue;
readonly requestedTapInfoKeysChange: Observable<TapInfoKey[]>;
constructor(tapInfoCacheService: TapInfoCacheService);
removeKeys(keys: TapInfoKey[]): void;
getValue<T = string>(key: TapInfoKeyObjectOrString): Promise<T>;
getValues<T extends any[] = unknown[]>(values: TapInfoKeyObjectOrString[]): Promise<T>;
reset(): void;
getLoadedKeyInfoChange<T>(info: TapInfoKeyObjectOrString): Observable<TapInfoHolder<T>>;
/**
* Refresh all keys
*/
refreshKeys(keysToRefresh: TapInfoKeyObjectOrString[]): Promise<void>;
private _refreshKeys;
/**
* Refresh a single key
* Resolve when refresh has been done (with error or success)
*/
refreshKey<T>(keyOrString: TapInfoKeyObjectOrString): Promise<TapInfoHolder<T>>;
/**
* @warning do not call this method inside executeTapAction or it will hang forever...
* @param allKeys
* @returns
*/
refreshKeysIfNeeded(allKeys: TapInfoKeyObjectOrString[]): Promise<void>;
/**
* Load key only if it's not already loaded
* @param key key to load
* @returns the info value
*/
loadKeyIfNotInCache<T>(key: TapInfoKeyObjectOrString): Promise<TapInfoHolder<T>>;
/**
* Load key only if it's not already loaded
* @param key keys to load
*/
loadKeysIfNotInCache(infos: TapInfoKeyObjectOrString[]): void;
/**
* Load key info
* If key has not been loaded for the device yet, it will to loaded it
* @param key
* @param params
* @returns
*/
loadKeyInfoChange<T>(key: TapInfoKeyObjectOrString): Observable<TapInfoHolder<T>>;
/**
*
* @param info: TapInfo
*/
getInfoValue<T = string>(info: TapInfoKeyObjectOrString): Promise<T>;
waitForKeySync(keysToWait: TapInfoKeyObjectOrString[]): Promise<void>;
static ɵfac: i0.ɵɵFactoryDeclaration<TapInfoRequestService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TapInfoRequestService>;
}