How to use the localforage/src/localforage.getItem function in localforage

To help you get started, we’ve selected a few localforage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github padloc / padloc / packages / app / src / lib / storage.ts View on Github external
async get(cls: T | StorableConstructor, id: string) {
        const s = cls instanceof Storable ? cls : new cls();
        const data = await localStorage.getItem(`${s.kind}_${id}`);
        if (!data) {
            throw new Err(ErrorCode.NOT_FOUND);
        }
        return s.fromRaw(data);
    }
github kalkih / mini-graph-card / src / main.js View on Github external
async getCache(key, compressed) {
    const data = await localForage.getItem(key + (compressed ? '' : '-raw'));
    return data ? (compressed ? decompress(data) : data) : null;
  }
github padloc / padloc / packages / app / src / storage.ts View on Github external
async get(cls: T | StorableConstructor, id: string) {
        const s = cls instanceof Storable ? cls : new cls();
        const data = await localStorage.getItem(`${s.kind}_${id}`);
        if (!data) {
            throw new Err(ErrorCode.NOT_FOUND);
        }
        return s.fromRaw(data);
    }