Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
814 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | var nextHandle = 1;
|
---|
4 | var RESOLVED = (function () { return Promise.resolve(); })();
|
---|
5 | var activeHandles = {};
|
---|
6 | function findAndClearHandle(handle) {
|
---|
7 | if (handle in activeHandles) {
|
---|
8 | delete activeHandles[handle];
|
---|
9 | return true;
|
---|
10 | }
|
---|
11 | return false;
|
---|
12 | }
|
---|
13 | exports.Immediate = {
|
---|
14 | setImmediate: function (cb) {
|
---|
15 | var handle = nextHandle++;
|
---|
16 | activeHandles[handle] = true;
|
---|
17 | RESOLVED.then(function () { return findAndClearHandle(handle) && cb(); });
|
---|
18 | return handle;
|
---|
19 | },
|
---|
20 | clearImmediate: function (handle) {
|
---|
21 | findAndClearHandle(handle);
|
---|
22 | },
|
---|
23 | };
|
---|
24 | exports.TestTools = {
|
---|
25 | pending: function () {
|
---|
26 | return Object.keys(activeHandles).length;
|
---|
27 | }
|
---|
28 | };
|
---|
29 | //# sourceMappingURL=Immediate.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.