22 lines
556 B
JavaScript
22 lines
556 B
JavaScript
|
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
||
|
var nextHandle = 1;
|
||
|
var tasksByHandle = {};
|
||
|
function runIfPresent(handle) {
|
||
|
var cb = tasksByHandle[handle];
|
||
|
if (cb) {
|
||
|
cb();
|
||
|
}
|
||
|
}
|
||
|
export var Immediate = {
|
||
|
setImmediate: function (cb) {
|
||
|
var handle = nextHandle++;
|
||
|
tasksByHandle[handle] = cb;
|
||
|
Promise.resolve().then(function () { return runIfPresent(handle); });
|
||
|
return handle;
|
||
|
},
|
||
|
clearImmediate: function (handle) {
|
||
|
delete tasksByHandle[handle];
|
||
|
},
|
||
|
};
|
||
|
//# sourceMappingURL=Immediate.js.map
|