import { StorageService } from 'jslib-common/abstractions/storage.service'; export class MemoryStorageService implements StorageService { private store = new Map(); get(key: string): Promise { if (this.store.has(key)) { const obj = this.store.get(key); return Promise.resolve(obj as T); } return Promise.resolve(null); } save(key: string, obj: any): Promise { if (obj == null) { return this.remove(key); } this.store.set(key, obj); return Promise.resolve(); } remove(key: string): Promise { this.store.delete(key); return Promise.resolve(); } }