@nent/core
Version:
28 lines (24 loc) • 558 B
JavaScript
/*!
* NENT 2022
*/
;
const index = require('./index-637e8c28.js');
const interfaces = require('./interfaces-95d0415a.js');
/* istanbul ignore file */
class InMemoryProvider {
constructor() {
this.data = {};
this.changed = new index.EventEmitter();
}
async get(key) {
return this.data[key] || null;
}
async set(key, value) {
this.data[key] = value;
this.changed.emit(interfaces.DATA_EVENTS.DataChanged);
}
destroy() {
this.changed.removeAllListeners();
}
}
exports.InMemoryProvider = InMemoryProvider;