@iotize/ionic
Version:
Iotize specific building blocks on top of @ionic/angular.
66 lines (65 loc) • 2.52 kB
TypeScript
import { TapResponse } from '@iotize/tap';
import { Observable } from 'rxjs';
import { GetResponseType, TapInfoHolder, TapInfoKey, TapInfoKeyObjectOrString } from './definitions';
import { TapInfoConfigService } from './tap-info-config.service';
import * as i0 from "@angular/core";
/**
* Will be renamed as TapConfigSyncService
*/
export declare class TapInfoCacheService {
private tapInfoConfigService;
/**
* Observables of infos
*/
private _infoChange;
constructor(tapInfoConfigService: TapInfoConfigService);
/**
* Subscribe to value change. Will be notified each time value for the given key changes
* @param key
* @returns
*/
valueChange<T>(key: TapInfoKeyObjectOrString): Observable<T>;
/**
* If value has already been loaded, it will be returned otherwise it will wait for a value to be resolved
* @param info
* @returns
*/
value<T = GetResponseType<TapInfoKeyObjectOrString>>(info: TapInfoKeyObjectOrString): Promise<T>;
infoChange<T>(key: TapInfoKeyObjectOrString): Observable<TapInfoHolder<T>>;
clearKeys(keys: TapInfoKeyObjectOrString[]): void;
getInfoSnapshot<T>(key: TapInfoKeyObjectOrString): TapInfoHolder<T> | undefined;
clearKey(key: TapInfoKeyObjectOrString): void;
reset(): void;
/**
* Return true if value has been loaded, even if it has errors
*/
isInfoLoaded(key: TapInfoKeyObjectOrString): boolean;
/**
* Returns true if value has been loaded.
*/
isValueLoaded(key: TapInfoKey): boolean | undefined;
setKeyError(key: TapInfoKeyObjectOrString, error: Error): TapInfoHolder;
setKeyValue<T>(key: TapInfoKeyObjectOrString, value: T): TapInfoHolder;
setKeyFromResponse(key: TapInfoKeyObjectOrString, r: TapResponse<any>): void;
setKeyInfo(key: TapInfoKeyObjectOrString, value: TapInfoHolder): TapInfoHolder<any>;
/**
* Notify new key value
*/
notifyNewValue(key: TapInfoKey, value: any): void;
/**
* Notify new key error
* @param key: TapInfo
* @param err: Error
* @param params?: any[]
*/
notifyKeyError(key: TapInfoKey, err: Error): void;
/**
* @deprecated use {@link isInfoLoaded()} instead
* @param key
* @returns
*/
isKeyInCache(key: TapInfoKeyObjectOrString): boolean;
private _createInfoObservableIfRequired;
static ɵfac: i0.ɵɵFactoryDeclaration<TapInfoCacheService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TapInfoCacheService>;
}