UNPKG

@nent/core

Version:

Functional elements to add routing, data-binding, dynamic HTML, declarative actions, audio, video, and so much more. Supercharge static HTML files into web apps without script or builds.

23 lines (22 loc) 482 B
/*! * NENT 2022 */ /* istanbul ignore file */ import { EventEmitter } from '../../common/emitter'; import { DATA_EVENTS } from '../interfaces'; export 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(); } }