UNPKG

reactronic

Version:

Reactronic - Transactional Reactive State Management

18 lines (17 loc) 600 B
import { Sealant } from "./Sealant.js"; export class SealedMap extends Map { clear() { throw Sealant.error(this); } delete(key) { throw Sealant.error(this); } set(key, value) { throw Sealant.error(this); } [Sealant.CreateCopy]() { return new Map(this.entries()); } } Object.defineProperty(Map.prototype, "toMutable", { configurable: false, enumerable: false, value() { return Sealant.toMutable(this); }, }); Object.defineProperty(Map.prototype, Sealant.SealedType, { value: SealedMap.prototype, configurable: false, enumerable: false, writable: false, });