UNPKG

@instantdb/core

Version:
29 lines 800 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const PersistedObject_js_1 = require("./utils/PersistedObject.js"); class InMemoryStore extends PersistedObject_js_1.StoreInterface { store; constructor(appId, dbName) { super(appId, dbName); this.store = new Map(); } async getItem(k) { return this.store.get(k) ?? null; } async setItem(k, v) { this.store.set(k, v); } async getAllKeys() { return [...this.store.keys()]; } async multiSet(keyValuePairs) { for (const [k, v] of keyValuePairs) { this.setItem(k, v); } } async removeItem(key) { this.store.delete(key); } } exports.default = InMemoryStore; //# sourceMappingURL=InMemoryStorage.js.map