import { IStorage } from "./IStorage"; export class DelayedStorage implements IStorage { constructor(private storage: Promise>) { } public async get(key: string): Promise { const storage = await this.storage; return storage.get(key); } public async set(key: string, value: T): Promise { const storage = await this.storage; return storage.set(key, value); } public async remove(key: string): Promise { const storage = await this.storage; return storage.remove(key); } public async getKeys(): Promise { const storage = await this.storage; return storage.getKeys(); } public async getInfo(key: string) { const storage = await this.storage; return storage.getInfo(key); } public async reset() { const storage = await this.storage; return storage.reset(); } public watchResync(callback: () => void): void { void this.storage.then(storage => { storage.watchResync?.(callback); }); } }