estilo
Version:
Create color schemes for Vim, NeoVim, Airline and Lightline
32 lines (31 loc) • 682 B
JavaScript
/**
* Handles storage and accessing of values
*
* In this case, we use it to store compiled template functions
* Indexed by their `name` or `filename`
*/
export class Cacher {
constructor(cache) {
Object.defineProperty(this, "cache", {
enumerable: true,
configurable: true,
writable: true,
value: cache
});
}
define(key, val) {
this.cache[key] = val;
}
get(key) {
return this.cache[key];
}
remove(key) {
delete this.cache[key];
}
reset() {
this.cache = {};
}
load(cacheObj) {
this.cache = { ...this.cache, ...cacheObj };
}
}