You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
585 B
22 lines
585 B
"use strict"; |
|
Object.defineProperty(exports, "__esModule", { value: true }); |
|
var nextHandle = 1; |
|
var tasksByHandle = {}; |
|
function runIfPresent(handle) { |
|
var cb = tasksByHandle[handle]; |
|
if (cb) { |
|
cb(); |
|
} |
|
} |
|
exports.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
|