@communities-webruntime/services
Version:
If you would like to run Lightning Web Runtime without the CLI, we expose some of our programmatic APIs available in Node.js. If you're looking for the CLI documentation [you can find that here](https://www.npmjs.com/package/@communities-webruntime/cli).
30 lines • 773 B
JavaScript
/** @hidden */
/**
* Copyright (c) 2019, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
/**
* A simple in-memory loading cache
*/
export class LoadingCache {
constructor(loader) {
this.cache = {};
this.loader = loader;
}
/* eslint-disable-next-line no-use-before-define */
get(key, loader = this.loader) {
if (loader && !this.cache[key]) {
this.cache[key] = loader(key);
}
return this.cache[key];
}
getValues() {
return Object.values(this.cache);
}
invalidateAll() {
this.cache = {};
}
}
//# sourceMappingURL=loading-cache.js.map