UNPKG

@web-atoms/core

Version:
36 lines (35 loc) 844 B
System.register([], function (_export, _context) { "use strict"; var AtomOnce; _export("AtomOnce", void 0); return { setters: [], execute: function () { _export("AtomOnce", AtomOnce = class AtomOnce { run(f) { if (this.isRunning) { return; } let isAsync = false; try { this.isRunning = true; const p = f(); if (p && p.then && p.catch) { isAsync = true; p.then(() => { this.isRunning = false; }).catch(() => { this.isRunning = false; }); } } finally { if (!isAsync) { this.isRunning = false; } } } }); } }; }); //# sourceMappingURL=AtomOnce.js.map