@nent/core
Version:
26 lines (23 loc) • 531 B
JavaScript
/*!
* NENT 2022
*/
import { E as EventEmitter } from './index-f7016b94.js';
import { D as DATA_EVENTS } from './interfaces-8c5cd1b8.js';
/* istanbul ignore file */
class InMemoryProvider {
constructor() {
this.data = {};
this.changed = new EventEmitter();
}
async get(key) {
return this.data[key] || null;
}
async set(key, value) {
this.data[key] = value;
this.changed.emit(DATA_EVENTS.DataChanged);
}
destroy() {
this.changed.removeAllListeners();
}
}
export { InMemoryProvider as I };