UNPKG

@web-atoms/core

Version:
35 lines (34 loc) 894 B
System.register(["./baseTypes"], function (_export, _context) { "use strict"; var registerInit; function Delay(delayInSeconds, repeat = false) { return (target, key) => { registerInit(target, vm => { const fx = vm[key]; const afx = () => { vm.app.runAsync(() => fx.apply(vm)); }; const dx = delayInSeconds * 1000; const id = repeat ? setInterval(afx, dx) : setTimeout(afx, dx); const d = { dispose() { if (repeat) { clearInterval(id); } else { clearTimeout(id); } } }; vm.registerDisposable(d); }); }; } _export("default", Delay); return { setters: [function (_baseTypes) { registerInit = _baseTypes.registerInit; }], execute: function () {} }; }); //# sourceMappingURL=Delay.js.map