vue-hooks-plus
Version:
Vue hooks library
19 lines (18 loc) • 584 B
JavaScript
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const cachePromise = /* @__PURE__ */ new Map();
const getCachePromise = (cacheKey) => {
return cachePromise.get(cacheKey);
};
const setCachePromise = (cacheKey, promise) => {
cachePromise.set(cacheKey, promise);
promise.then((res) => {
cachePromise.delete(cacheKey);
return res;
}).catch((err) => {
cachePromise.delete(cacheKey);
throw err;
});
};
exports.getCachePromise = getCachePromise;
exports.setCachePromise = setCachePromise;
;