This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/rxjs/_esm2015/internal/util/Immediate.js
2019-08-11 20:48:02 +02:00

20 lines
No EOL
479 B
JavaScript

let nextHandle = 1;
const tasksByHandle = {};
function runIfPresent(handle) {
const cb = tasksByHandle[handle];
if (cb) {
cb();
}
}
export const Immediate = {
setImmediate(cb) {
const handle = nextHandle++;
tasksByHandle[handle] = cb;
Promise.resolve().then(() => runIfPresent(handle));
return handle;
},
clearImmediate(handle) {
delete tasksByHandle[handle];
},
};
//# sourceMappingURL=Immediate.js.map