worker-timers-worker 9.0.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/es2019/factories/clear-timer.d.ts +1 -1
- package/build/es2019/factories/clear-timer.d.ts.map +1 -1
- package/build/es2019/factories/clear-timer.js +2 -2
- package/build/es2019/factories/clear-timer.js.map +1 -1
- package/build/es2019/module.js +2 -2
- package/build/es2019/module.js.map +1 -1
- package/build/es5/bundle.js +33 -15
- package/package.json +10 -10
- package/src/factories/clear-timer.ts +2 -2
- package/src/module.ts +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TResolveSetResponseResultPromise } from '../types';
|
|
2
|
-
export declare const createClearTimer: (identifiersAndResolvers: Map<number, [number, TResolveSetResponseResultPromise]>) => (timerId: number) => boolean
|
|
2
|
+
export declare const createClearTimer: (identifiersAndResolvers: Map<number, [number, TResolveSetResponseResultPromise]>) => (timerId: number) => Promise<boolean>;
|
|
3
3
|
//# sourceMappingURL=clear-timer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-timer.d.ts","sourceRoot":"","sources":["../../../src/factories/clear-timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAE5D,eAAO,MAAM,gBAAgB,4BAA6B,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,gCAAgC,CAAC,CAAC,eAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"clear-timer.d.ts","sourceRoot":"","sources":["../../../src/factories/clear-timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAE5D,eAAO,MAAM,gBAAgB,4BAA6B,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,gCAAgC,CAAC,CAAC,eAAe,MAAM,qBAerI,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const createClearTimer = (identifiersAndResolvers) => (timerId) => {
|
|
2
2
|
const identifiersAndResolver = identifiersAndResolvers.get(timerId);
|
|
3
3
|
if (identifiersAndResolver === undefined) {
|
|
4
|
-
return false;
|
|
4
|
+
return Promise.resolve(false);
|
|
5
5
|
}
|
|
6
6
|
const [identifier, resolveSetResponseResultPromise] = identifiersAndResolver;
|
|
7
7
|
clearTimeout(identifier);
|
|
8
8
|
identifiersAndResolvers.delete(timerId);
|
|
9
9
|
resolveSetResponseResultPromise(false);
|
|
10
|
-
return true;
|
|
10
|
+
return Promise.resolve(true);
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=clear-timer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-timer.js","sourceRoot":"","sources":["../../../src/factories/clear-timer.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,uBAAgF,EAAE,EAAE,CAAC,CAAC,OAAe,EAAE,EAAE;IACtI,MAAM,sBAAsB,GAAG,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEpE,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;QACvC,OAAO,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"clear-timer.js","sourceRoot":"","sources":["../../../src/factories/clear-timer.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,uBAAgF,EAAE,EAAE,CAAC,CAAC,OAAe,EAAE,EAAE;IACtI,MAAM,sBAAsB,GAAG,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEpE,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;QACvC,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,UAAU,EAAE,+BAA+B,CAAC,GAAG,sBAAsB,CAAC;IAE7E,YAAY,CAAC,UAAU,CAAC,CAAC;IACzB,uBAAuB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAExC,+BAA+B,CAAC,KAAK,CAAC,CAAC;IAEvC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC"}
|
package/build/es2019/module.js
CHANGED
|
@@ -16,8 +16,8 @@ const clearTimeout = createClearTimer(timeoutIdentifiersAndResolvers);
|
|
|
16
16
|
const setInterval = createSetTimer(computeDelayAndExpectedCallbackTime, intervalIdentifiersAndResolvers, setTimeoutCallback);
|
|
17
17
|
const setTimeout = createSetTimer(computeDelayAndExpectedCallbackTime, timeoutIdentifiersAndResolvers, setTimeoutCallback);
|
|
18
18
|
createWorker(self, {
|
|
19
|
-
clear: ({ timerId, timerType }) => {
|
|
20
|
-
return { result: timerType === 'interval' ? clearInterval(timerId) : clearTimeout(timerId) };
|
|
19
|
+
clear: async ({ timerId, timerType }) => {
|
|
20
|
+
return { result: await (timerType === 'interval' ? clearInterval(timerId) : clearTimeout(timerId)) };
|
|
21
21
|
},
|
|
22
22
|
set: async ({ delay, now, timerId, timerType }) => {
|
|
23
23
|
return { result: await (timerType === 'interval' ? setInterval : setTimeout)(delay, now, timerId) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,mCAAmC,EAAE,MAAM,sDAAsD,CAAC;AAC3G,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAItE;;;GAGG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAE9B,MAAM,+BAA+B,GAA4D,IAAI,GAAG,EAAE,CAAC;AAC3G,MAAM,aAAa,GAAG,gBAA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AAO,EAAE,SAAS,EAAE,EAAE,EAAE;QACpC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;IACzG,CAAC;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;QAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC;IACxG,CAAC;CACJ,CAAC,CAAC"}
|
package/build/es5/bundle.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
return function (timerId) {
|
|
9
9
|
var identifiersAndResolver = identifiersAndResolvers.get(timerId);
|
|
10
10
|
if (identifiersAndResolver === undefined) {
|
|
11
|
-
return false;
|
|
11
|
+
return Promise.resolve(false);
|
|
12
12
|
}
|
|
13
13
|
var _identifiersAndResolv = _slicedToArray(identifiersAndResolver, 2),
|
|
14
14
|
identifier = _identifiersAndResolv[0],
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
clearTimeout(identifier);
|
|
17
17
|
identifiersAndResolvers["delete"](timerId);
|
|
18
18
|
resolveSetResponseResultPromise(false);
|
|
19
|
-
return true;
|
|
19
|
+
return Promise.resolve(true);
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -58,22 +58,15 @@
|
|
|
58
58
|
var setInterval = createSetTimer(computeDelayAndExpectedCallbackTime, intervalIdentifiersAndResolvers, _setTimeoutCallback);
|
|
59
59
|
var setTimeout$1 = createSetTimer(computeDelayAndExpectedCallbackTime, timeoutIdentifiersAndResolvers, _setTimeoutCallback);
|
|
60
60
|
workerFactory.createWorker(self, {
|
|
61
|
-
clear: function
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
result: timerType === 'interval' ? clearInterval(timerId) : clearTimeout$1(timerId)
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
set: function () {
|
|
69
|
-
var _set = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
70
|
-
var delay, now, timerId, timerType;
|
|
61
|
+
clear: function () {
|
|
62
|
+
var _clear = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
63
|
+
var timerId, timerType;
|
|
71
64
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
72
65
|
while (1) switch (_context.prev = _context.next) {
|
|
73
66
|
case 0:
|
|
74
|
-
|
|
67
|
+
timerId = _ref.timerId, timerType = _ref.timerType;
|
|
75
68
|
_context.next = 3;
|
|
76
|
-
return
|
|
69
|
+
return timerType === 'interval' ? clearInterval(timerId) : clearTimeout$1(timerId);
|
|
77
70
|
case 3:
|
|
78
71
|
_context.t0 = _context.sent;
|
|
79
72
|
return _context.abrupt("return", {
|
|
@@ -85,7 +78,32 @@
|
|
|
85
78
|
}
|
|
86
79
|
}, _callee);
|
|
87
80
|
}));
|
|
88
|
-
function
|
|
81
|
+
function clear(_x) {
|
|
82
|
+
return _clear.apply(this, arguments);
|
|
83
|
+
}
|
|
84
|
+
return clear;
|
|
85
|
+
}(),
|
|
86
|
+
set: function () {
|
|
87
|
+
var _set = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
88
|
+
var delay, now, timerId, timerType;
|
|
89
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
90
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
91
|
+
case 0:
|
|
92
|
+
delay = _ref2.delay, now = _ref2.now, timerId = _ref2.timerId, timerType = _ref2.timerType;
|
|
93
|
+
_context2.next = 3;
|
|
94
|
+
return (timerType === 'interval' ? setInterval : setTimeout$1)(delay, now, timerId);
|
|
95
|
+
case 3:
|
|
96
|
+
_context2.t0 = _context2.sent;
|
|
97
|
+
return _context2.abrupt("return", {
|
|
98
|
+
result: _context2.t0
|
|
99
|
+
});
|
|
100
|
+
case 5:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context2.stop();
|
|
103
|
+
}
|
|
104
|
+
}, _callee2);
|
|
105
|
+
}));
|
|
106
|
+
function set(_x2) {
|
|
89
107
|
return _set.apply(this, arguments);
|
|
90
108
|
}
|
|
91
109
|
return set;
|
package/package.json
CHANGED
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/runtime": "^7.26.
|
|
18
|
+
"@babel/runtime": "^7.26.9",
|
|
19
19
|
"tslib": "^2.8.1",
|
|
20
|
-
"worker-factory": "^7.0.
|
|
20
|
+
"worker-factory": "^7.0.37"
|
|
21
21
|
},
|
|
22
22
|
"description": "The worker which is used by the worker-timers package.",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@babel/core": "^7.26.
|
|
24
|
+
"@babel/core": "^7.26.9",
|
|
25
25
|
"@babel/plugin-external-helpers": "^7.25.9",
|
|
26
|
-
"@babel/plugin-transform-runtime": "^7.26.
|
|
27
|
-
"@babel/preset-env": "^7.26.
|
|
26
|
+
"@babel/plugin-transform-runtime": "^7.26.9",
|
|
27
|
+
"@babel/preset-env": "^7.26.9",
|
|
28
28
|
"@commitlint/cli": "^19.7.1",
|
|
29
29
|
"@commitlint/config-angular": "^19.7.1",
|
|
30
30
|
"@rollup/plugin-babel": "^6.0.4",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"commitizen": "^4.3.1",
|
|
33
33
|
"cz-conventional-changelog": "^3.3.0",
|
|
34
34
|
"eslint": "^8.57.0",
|
|
35
|
-
"eslint-config-holy-grail": "^60.0.
|
|
35
|
+
"eslint-config-holy-grail": "^60.0.19",
|
|
36
36
|
"grunt": "^1.6.1",
|
|
37
37
|
"grunt-cli": "^1.5.0",
|
|
38
38
|
"grunt-sh": "^0.2.1",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"load-grunt-config": "^4.0.1",
|
|
52
52
|
"memory-fs": "^0.5.0",
|
|
53
53
|
"mocha": "^10.8.2",
|
|
54
|
-
"prettier": "^3.5.
|
|
54
|
+
"prettier": "^3.5.2",
|
|
55
55
|
"rimraf": "^6.0.1",
|
|
56
|
-
"rollup": "^4.34.
|
|
56
|
+
"rollup": "^4.34.8",
|
|
57
57
|
"sinon": "^17.0.2",
|
|
58
58
|
"sinon-chai": "^3.7.0",
|
|
59
59
|
"ts-loader": "^9.5.2",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"tslint": "^6.1.3",
|
|
62
62
|
"tslint-config-holy-grail": "^56.0.6",
|
|
63
63
|
"typescript": "^5.7.3",
|
|
64
|
-
"webpack": "^5.
|
|
64
|
+
"webpack": "^5.98.0"
|
|
65
65
|
},
|
|
66
66
|
"files": [
|
|
67
67
|
"build/es2019/",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"test": "grunt lint && grunt test"
|
|
89
89
|
},
|
|
90
90
|
"types": "build/es2019/module.d.ts",
|
|
91
|
-
"version": "9.0.
|
|
91
|
+
"version": "9.0.2"
|
|
92
92
|
}
|
|
@@ -4,7 +4,7 @@ export const createClearTimer = (identifiersAndResolvers: Map<number, [number, T
|
|
|
4
4
|
const identifiersAndResolver = identifiersAndResolvers.get(timerId);
|
|
5
5
|
|
|
6
6
|
if (identifiersAndResolver === undefined) {
|
|
7
|
-
return false;
|
|
7
|
+
return Promise.resolve(false);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const [identifier, resolveSetResponseResultPromise] = identifiersAndResolver;
|
|
@@ -14,5 +14,5 @@ export const createClearTimer = (identifiersAndResolvers: Map<number, [number, T
|
|
|
14
14
|
|
|
15
15
|
resolveSetResponseResultPromise(false);
|
|
16
16
|
|
|
17
|
-
return true;
|
|
17
|
+
return Promise.resolve(true);
|
|
18
18
|
};
|
package/src/module.ts
CHANGED
|
@@ -21,8 +21,8 @@ const setInterval = createSetTimer(computeDelayAndExpectedCallbackTime, interval
|
|
|
21
21
|
const setTimeout = createSetTimer(computeDelayAndExpectedCallbackTime, timeoutIdentifiersAndResolvers, setTimeoutCallback);
|
|
22
22
|
|
|
23
23
|
createWorker<IWorkerTimersWorkerCustomDefinition>(self, <TWorkerImplementation<IWorkerTimersWorkerCustomDefinition>>{
|
|
24
|
-
clear: ({ timerId, timerType }) => {
|
|
25
|
-
return { result: timerType === 'interval' ? clearInterval(timerId) : clearTimeout(timerId) };
|
|
24
|
+
clear: async ({ timerId, timerType }) => {
|
|
25
|
+
return { result: await (timerType === 'interval' ? clearInterval(timerId) : clearTimeout(timerId)) };
|
|
26
26
|
},
|
|
27
27
|
set: async ({ delay, now, timerId, timerType }) => {
|
|
28
28
|
return { result: await (timerType === 'interval' ? setInterval : setTimeout)(delay, now, timerId) };
|