reactronic
Version:
Reactronic - Transactional Reactive State Management
18 lines (17 loc) • 596 B
JavaScript
import { Sealant } from "./Sealant.js";
export class SealedSet extends Set {
add(value) { throw Sealant.error(this); }
clear() { throw Sealant.error(this); }
delete(value) { throw Sealant.error(this); }
[Sealant.CreateCopy]() { return new Set(this.values()); }
}
Object.defineProperty(Set.prototype, "toMutable", {
configurable: false, enumerable: false,
value() {
return Sealant.toMutable(this);
},
});
Object.defineProperty(Set.prototype, Sealant.SealedType, {
value: SealedSet.prototype,
configurable: false, enumerable: false, writable: false,
});