UNPKG

@hazae41/glacier

Version:

Yet another React data (re)fetching library

1 lines 1.13 kB
{"version":3,"file":"index.mjs","sources":["../../../../../../src/mods/storages/awaiting/index.ts"],"sourcesContent":["import { RawState } from \"mods/types/state.js\"\nimport { QueryStorage } from \"../storage.js\"\n\nexport class AwaitingQueryStorage<T extends QueryStorage> {\n\n constructor(\n readonly storage: Promise<T>,\n ) {\n storage.catch(console.error)\n }\n\n async getOrThrow(cacheKey: string) {\n return await this.storage.then(x => x.getOrThrow(cacheKey))\n }\n\n async setOrThrow(cacheKey: string, value: RawState) {\n return await this.storage.then(x => x.setOrThrow(cacheKey, value))\n }\n\n}"],"names":[],"mappings":"MAGa,oBAAoB,CAAA;AAGpB,IAAA,OAAA,CAAA;AADX,IAAA,WAAA,CACW,OAAmB,EAAA;QAAnB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAY;AAE5B,QAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;KAC7B;IAED,MAAM,UAAU,CAAC,QAAgB,EAAA;AAC/B,QAAA,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;KAC5D;AAED,IAAA,MAAM,UAAU,CAAC,QAAgB,EAAE,KAAe,EAAA;QAChD,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;KACnE;AAEF;;;;"}