quasar
Version:
Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
22 lines (19 loc) • 505 B
JavaScript
export default function () {
const cache = new Map()
return {
getCache: __QUASAR_SSR_SERVER__
? function (_, obj) { return obj }
: function (key, obj) {
return cache[ key ] === void 0
? (cache[ key ] = obj)
: cache[ key ]
},
getCacheWithFn: __QUASAR_SSR_SERVER__
? function (_, fn) { return fn() }
: function (key, fn) {
return cache[ key ] === void 0
? (cache[ key ] = fn())
: cache[ key ]
}
}
}