UNPKG

@devcycle/js-client-sdk

Version:

The Javascript Client SDK for DevCycle

34 lines (33 loc) 1.33 kB
import { DVCStorage } from './types'; export declare abstract class StorageStrategy implements DVCStorage { abstract store: unknown; abstract init(): Promise<unknown>; abstract save(storeKey: string, data: unknown): Promise<void>; abstract load<T>(storeKey: string): Promise<T | undefined>; abstract remove(storeKey: string): Promise<void>; abstract listKeys(prefix: string): Promise<string[]>; } export declare class LocalStorageStrategy extends StorageStrategy { store: Storage; private isTesting; constructor(isTesting?: boolean); init(): Promise<void>; save(storeKey: string, data: unknown): Promise<void>; load<T>(storeKey: string): Promise<T | undefined>; remove(storeKey: string): Promise<void>; listKeys(prefix: string): Promise<string[]>; } export declare class IndexedDBStrategy extends StorageStrategy { store: IDBDatabase; private isReady; private connectionPromise; private static storeName; private static DBName; constructor(); init(): Promise<IDBDatabase>; save(storeKey: string, data: unknown): Promise<void>; load<T>(storeKey: string): Promise<T | undefined>; remove(storeKey: string): Promise<void>; listKeys(prefix: string): Promise<string[]>; } export declare function getStorageStrategy(): StorageStrategy;