UNPKG

@web-atoms/core

Version:
39 lines (38 loc) 980 B
System.register([], function (_export, _context) { "use strict"; var AtomDisposableList; _export("AtomDisposableList", void 0); return { setters: [], execute: function () { _export("AtomDisposableList", AtomDisposableList = class AtomDisposableList { constructor() { this.disposables = []; } add(d) { if (typeof d === "function") { const fx = d; d = { dispose: fx }; } this.disposables.push(d); const dx = d; return { dispose: () => { this.disposables = this.disposables.filter(x => x !== dx); dx.dispose(); } }; } dispose() { for (const iterator of this.disposables) { iterator.dispose(); } this.disposables.length = 0; } }); } }; }); //# sourceMappingURL=AtomDisposableList.js.map