worker-timers 7.0.55 → 7.0.57
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/load-or-return-broker.d.ts +2 -0
- package/build/es2019/factories/load-or-return-broker.d.ts.map +1 -0
- package/build/es2019/factories/load-or-return-broker.js +15 -0
- package/build/es2019/factories/load-or-return-broker.js.map +1 -0
- package/build/es2019/module.d.ts +5 -6
- package/build/es2019/module.d.ts.map +1 -1
- package/build/es2019/module.js +6 -11
- package/build/es2019/module.js.map +1 -1
- package/build/es5/bundle.js +16 -16
- package/package.json +12 -10
- package/src/factories/load-or-return-broker.ts +19 -0
- package/src/module.ts +6 -14
- package/build/es2019/factories/load-worker-timers.d.ts +0 -3
- package/build/es2019/factories/load-worker-timers.d.ts.map +0 -1
- package/build/es2019/factories/load-worker-timers.js +0 -15
- package/build/es2019/factories/load-worker-timers.js.map +0 -1
- package/build/es2019/types/index.d.ts +0 -4
- package/build/es2019/types/index.d.ts.map +0 -1
- package/build/es2019/types/index.js +0 -4
- package/build/es2019/types/index.js.map +0 -1
- package/build/es2019/types/load-worker-timers-factory.d.ts +0 -4
- package/build/es2019/types/load-worker-timers-factory.d.ts.map +0 -1
- package/build/es2019/types/load-worker-timers-factory.js +0 -2
- package/build/es2019/types/load-worker-timers-factory.js.map +0 -1
- package/build/es2019/types/load-worker-timers-function.d.ts +0 -3
- package/build/es2019/types/load-worker-timers-function.d.ts.map +0 -1
- package/build/es2019/types/load-worker-timers-function.js +0 -2
- package/build/es2019/types/load-worker-timers-function.js.map +0 -1
- package/build/es2019/types/worker-timers.d.ts +0 -3
- package/build/es2019/types/worker-timers.d.ts.map +0 -1
- package/build/es2019/types/worker-timers.js +0 -2
- package/build/es2019/types/worker-timers.js.map +0 -1
- package/src/factories/load-worker-timers.ts +0 -21
- package/src/types/index.ts +0 -3
- package/src/types/load-worker-timers-factory.ts +0 -4
- package/src/types/load-worker-timers-function.ts +0 -3
- package/src/types/worker-timers.ts +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-or-return-broker.d.ts","sourceRoot":"","sources":["../../../src/factories/load-or-return-broker.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,6BAA8B,MAAM,qBAAqB,MAAM,iBAkBnG,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const createLoadOrReturnBroker = (loadBroker, worker) => {
|
|
2
|
+
let broker = null;
|
|
3
|
+
return () => {
|
|
4
|
+
if (broker !== null) {
|
|
5
|
+
return broker;
|
|
6
|
+
}
|
|
7
|
+
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
|
|
8
|
+
const url = URL.createObjectURL(blob);
|
|
9
|
+
broker = loadBroker(url);
|
|
10
|
+
// Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
|
|
11
|
+
setTimeout(() => URL.revokeObjectURL(url));
|
|
12
|
+
return broker;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=load-or-return-broker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-or-return-broker.js","sourceRoot":"","sources":["../../../src/factories/load-or-return-broker.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAS,UAAmC,EAAE,MAAc,EAAE,EAAE;IACpG,IAAI,MAAM,GAAkB,IAAI,CAAC;IAEjC,OAAO,GAAG,EAAE;QACR,IAAI,MAAM,KAAK,IAAI,EAAE;YACjB,OAAO,MAAM,CAAC;SACjB;QAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,uCAAuC,EAAE,CAAC,CAAC;QACnF,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAEtC,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAEzB,wEAAwE;QACxE,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;QAE3C,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC,CAAC"}
|
package/build/es2019/module.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const setTimeout: TWorkerTimers['setTimeout'];
|
|
1
|
+
import { load } from 'worker-timers-broker';
|
|
2
|
+
export declare const clearInterval: ReturnType<typeof load>['clearInterval'];
|
|
3
|
+
export declare const clearTimeout: ReturnType<typeof load>['clearTimeout'];
|
|
4
|
+
export declare const setInterval: ReturnType<typeof load>['setInterval'];
|
|
5
|
+
export declare const setTimeout: ReturnType<typeof load>['setTimeout'];
|
|
7
6
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAM5C,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,eAAe,CAA4D,CAAC;AAEhI,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,cAAc,CAA2D,CAAC;AAE7H,eAAO,MAAM,WAAW,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,aAAa,CAAkE,CAAC;AAElI,eAAO,MAAM,UAAU,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,YAAY,CAAiE,CAAC"}
|
package/build/es2019/module.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { load } from 'worker-timers-broker';
|
|
2
|
-
import {
|
|
2
|
+
import { createLoadOrReturnBroker } from './factories/load-or-return-broker';
|
|
3
3
|
import { worker } from './worker/worker';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
const loadWorkerTimers = createLoadWorkerTimers(load, worker);
|
|
10
|
-
export const clearInterval = (timerId) => loadWorkerTimers().clearInterval(timerId);
|
|
11
|
-
export const clearTimeout = (timerId) => loadWorkerTimers().clearTimeout(timerId);
|
|
12
|
-
export const setInterval = (func, delay) => loadWorkerTimers().setInterval(func, delay);
|
|
13
|
-
export const setTimeout = (func, delay) => loadWorkerTimers().setTimeout(func, delay);
|
|
4
|
+
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
5
|
+
export const clearInterval = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
6
|
+
export const clearTimeout = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
|
|
7
|
+
export const setInterval = (func, delay) => loadOrReturnBroker().setInterval(func, delay);
|
|
8
|
+
export const setTimeout = (func, delay) => loadOrReturnBroker().setTimeout(func, delay);
|
|
14
9
|
//# sourceMappingURL=module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,aAAa,GAA6C,CAAC,OAAO,EAAE,EAAE,CAAC,kBAAkB,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAEhI,MAAM,CAAC,MAAM,YAAY,GAA4C,CAAC,OAAO,EAAE,EAAE,CAAC,kBAAkB,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AAE7H,MAAM,CAAC,MAAM,WAAW,GAA2C,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,kBAAkB,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAElI,MAAM,CAAC,MAAM,UAAU,GAA0C,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,kBAAkB,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC"}
|
package/build/es5/bundle.js
CHANGED
|
@@ -4,46 +4,46 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.workerTimers = {}, global.workerTimersBroker));
|
|
5
5
|
})(this, (function (exports, workerTimersBroker) { 'use strict';
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
|
|
7
|
+
var createLoadOrReturnBroker = function createLoadOrReturnBroker(loadBroker, worker) {
|
|
8
|
+
var broker = null;
|
|
9
9
|
return function () {
|
|
10
|
-
if (
|
|
11
|
-
return
|
|
10
|
+
if (broker !== null) {
|
|
11
|
+
return broker;
|
|
12
12
|
}
|
|
13
13
|
var blob = new Blob([worker], {
|
|
14
14
|
type: 'application/javascript; charset=utf-8'
|
|
15
15
|
});
|
|
16
16
|
var url = URL.createObjectURL(blob);
|
|
17
|
-
|
|
18
|
-
// Bug #1: Edge
|
|
19
|
-
|
|
17
|
+
broker = loadBroker(url);
|
|
18
|
+
// Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
|
|
19
|
+
setTimeout(function () {
|
|
20
20
|
return URL.revokeObjectURL(url);
|
|
21
|
-
}
|
|
22
|
-
return
|
|
21
|
+
});
|
|
22
|
+
return broker;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
// This is the minified and stringified code of the worker-timers-worker package.
|
|
27
27
|
var worker = "(()=>{var e={67:(e,t,r)=>{var o,i;void 0===(i=\"function\"==typeof(o=function(){\"use strict\";var e=new Map,t=new Map,r=function(t){var r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id \"'.concat(t,'\".'));clearTimeout(r),e.delete(t)},o=function(e){var r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id \"'.concat(e,'\".'));clearTimeout(r),t.delete(e)},i=function(e,t){var r,o=performance.now();return{expected:o+(r=e-Math.max(0,o-t)),remainingDelay:r}},n=function e(t,r,o,i){var n=performance.now();n>o?postMessage({id:null,method:\"call\",params:{timerId:r,timerType:i}}):t.set(r,setTimeout(e,o-n,t,r,o,i))},a=function(t,r,o){var a=i(t,o),s=a.expected,d=a.remainingDelay;e.set(r,setTimeout(n,d,e,r,s,\"interval\"))},s=function(e,r,o){var a=i(e,o),s=a.expected,d=a.remainingDelay;t.set(r,setTimeout(n,d,t,r,s,\"timeout\"))};addEventListener(\"message\",(function(e){var t=e.data;try{if(\"clear\"===t.method){var i=t.id,n=t.params,d=n.timerId,c=n.timerType;if(\"interval\"===c)r(d),postMessage({error:null,id:i});else{if(\"timeout\"!==c)throw new Error('The given type \"'.concat(c,'\" is not supported'));o(d),postMessage({error:null,id:i})}}else{if(\"set\"!==t.method)throw new Error('The given method \"'.concat(t.method,'\" is not supported'));var u=t.params,l=u.delay,p=u.now,m=u.timerId,v=u.timerType;if(\"interval\"===v)a(l,m,p);else{if(\"timeout\"!==v)throw new Error('The given type \"'.concat(v,'\" is not supported'));s(l,m,p)}}}catch(e){postMessage({error:{message:e.message},id:t.id,result:null})}}))})?o.call(t,r,t,e):o)||(e.exports=i)}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{\"use strict\";r(67)})()})();"; // tslint:disable-line:max-line-length
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var loadOrReturnBroker = createLoadOrReturnBroker(workerTimersBroker.load, worker);
|
|
30
30
|
var clearInterval = function clearInterval(timerId) {
|
|
31
|
-
return
|
|
31
|
+
return loadOrReturnBroker().clearInterval(timerId);
|
|
32
32
|
};
|
|
33
33
|
var clearTimeout = function clearTimeout(timerId) {
|
|
34
|
-
return
|
|
34
|
+
return loadOrReturnBroker().clearTimeout(timerId);
|
|
35
35
|
};
|
|
36
36
|
var setInterval = function setInterval(func, delay) {
|
|
37
|
-
return
|
|
37
|
+
return loadOrReturnBroker().setInterval(func, delay);
|
|
38
38
|
};
|
|
39
|
-
var setTimeout = function setTimeout(func, delay) {
|
|
40
|
-
return
|
|
39
|
+
var setTimeout$1 = function setTimeout(func, delay) {
|
|
40
|
+
return loadOrReturnBroker().setTimeout(func, delay);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
exports.clearInterval = clearInterval;
|
|
44
44
|
exports.clearTimeout = clearTimeout;
|
|
45
45
|
exports.setInterval = setInterval;
|
|
46
|
-
exports.setTimeout = setTimeout;
|
|
46
|
+
exports.setTimeout = setTimeout$1;
|
|
47
47
|
|
|
48
48
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
49
49
|
|
package/package.json
CHANGED
|
@@ -15,22 +15,24 @@
|
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/runtime": "^7.
|
|
19
|
-
"tslib": "^2.4.
|
|
20
|
-
"worker-timers-broker": "^6.0.
|
|
21
|
-
"worker-timers-worker": "^7.0.
|
|
18
|
+
"@babel/runtime": "^7.20.1",
|
|
19
|
+
"tslib": "^2.4.1",
|
|
20
|
+
"worker-timers-broker": "^6.0.77",
|
|
21
|
+
"worker-timers-worker": "^7.0.43"
|
|
22
22
|
},
|
|
23
23
|
"description": "A replacement for setInterval() and setTimeout() which works in unfocused windows.",
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@babel/cli": "^7.19.3",
|
|
25
26
|
"@babel/core": "^7.19.6",
|
|
26
27
|
"@babel/plugin-external-helpers": "^7.18.6",
|
|
27
28
|
"@babel/plugin-transform-runtime": "^7.19.6",
|
|
28
29
|
"@babel/preset-env": "^7.19.4",
|
|
29
|
-
"@
|
|
30
|
-
"@commitlint/
|
|
30
|
+
"@babel/register": "^7.18.9",
|
|
31
|
+
"@commitlint/cli": "^17.2.0",
|
|
32
|
+
"@commitlint/config-angular": "^17.2.0",
|
|
31
33
|
"@rollup/plugin-babel": "^5.3.1",
|
|
32
34
|
"@rollup/plugin-replace": "^4.0.0",
|
|
33
|
-
"babel-loader": "^8.
|
|
35
|
+
"babel-loader": "^8.3.0",
|
|
34
36
|
"chai": "^4.3.6",
|
|
35
37
|
"commitizen": "^4.2.5",
|
|
36
38
|
"cz-conventional-changelog": "^3.3.0",
|
|
@@ -49,8 +51,8 @@
|
|
|
49
51
|
"karma-sinon-chai": "^2.0.2",
|
|
50
52
|
"karma-webpack": "^5.0.0",
|
|
51
53
|
"load-grunt-config": "^4.0.1",
|
|
52
|
-
"memfs": "^3.4.
|
|
53
|
-
"mocha": "^
|
|
54
|
+
"memfs": "^3.4.10",
|
|
55
|
+
"mocha": "^10.1.0",
|
|
54
56
|
"prettier": "^2.7.1",
|
|
55
57
|
"pretty-quick": "^3.1.3",
|
|
56
58
|
"rimraf": "^3.0.2",
|
|
@@ -95,5 +97,5 @@
|
|
|
95
97
|
"test": "grunt lint && grunt test"
|
|
96
98
|
},
|
|
97
99
|
"types": "build/es2019/module.d.ts",
|
|
98
|
-
"version": "7.0.
|
|
100
|
+
"version": "7.0.57"
|
|
99
101
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const createLoadOrReturnBroker = <Broker>(loadBroker: (url: string) => Broker, worker: string) => {
|
|
2
|
+
let broker: null | Broker = null;
|
|
3
|
+
|
|
4
|
+
return () => {
|
|
5
|
+
if (broker !== null) {
|
|
6
|
+
return broker;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
|
|
10
|
+
const url = URL.createObjectURL(blob);
|
|
11
|
+
|
|
12
|
+
broker = loadBroker(url);
|
|
13
|
+
|
|
14
|
+
// Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
|
|
15
|
+
setTimeout(() => URL.revokeObjectURL(url));
|
|
16
|
+
|
|
17
|
+
return broker;
|
|
18
|
+
};
|
|
19
|
+
};
|
package/src/module.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { load } from 'worker-timers-broker';
|
|
2
|
-
import {
|
|
2
|
+
import { createLoadOrReturnBroker } from './factories/load-or-return-broker';
|
|
3
3
|
import { worker } from './worker/worker';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* @todo Explicitly referencing the barrel file seems to be necessary when enabling the
|
|
7
|
-
* isolatedModules compiler option.
|
|
8
|
-
*/
|
|
9
|
-
export * from './types/index';
|
|
5
|
+
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
10
6
|
|
|
11
|
-
const
|
|
7
|
+
export const clearInterval: ReturnType<typeof load>['clearInterval'] = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
export const clearTimeout: ReturnType<typeof load>['clearTimeout'] = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
|
|
14
10
|
|
|
15
|
-
export const
|
|
11
|
+
export const setInterval: ReturnType<typeof load>['setInterval'] = (func, delay) => loadOrReturnBroker().setInterval(func, delay);
|
|
16
12
|
|
|
17
|
-
export const
|
|
18
|
-
|
|
19
|
-
export const setInterval: TWorkerTimers['setInterval'] = (func, delay) => loadWorkerTimers().setInterval(func, delay);
|
|
20
|
-
|
|
21
|
-
export const setTimeout: TWorkerTimers['setTimeout'] = (func, delay) => loadWorkerTimers().setTimeout(func, delay);
|
|
13
|
+
export const setTimeout: ReturnType<typeof load>['setTimeout'] = (func, delay) => loadOrReturnBroker().setTimeout(func, delay);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-worker-timers.d.ts","sourceRoot":"","sources":["../../../src/factories/load-worker-timers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAiB,MAAM,UAAU,CAAC;AAInE,eAAO,MAAM,sBAAsB,EAAE,wBAgBpC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
let workerTimers = null;
|
|
2
|
-
export const createLoadWorkerTimers = (load, worker) => {
|
|
3
|
-
return () => {
|
|
4
|
-
if (workerTimers !== null) {
|
|
5
|
-
return workerTimers;
|
|
6
|
-
}
|
|
7
|
-
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
|
|
8
|
-
const url = URL.createObjectURL(blob);
|
|
9
|
-
workerTimers = load(url);
|
|
10
|
-
// Bug #1: Edge doesn't like the URL to be revoked directly.
|
|
11
|
-
workerTimers.setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
12
|
-
return workerTimers;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=load-worker-timers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-worker-timers.js","sourceRoot":"","sources":["../../../src/factories/load-worker-timers.ts"],"names":[],"mappings":"AAEA,IAAI,YAAY,GAAyB,IAAI,CAAC;AAE9C,MAAM,CAAC,MAAM,sBAAsB,GAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;IAC7E,OAAO,GAAG,EAAE;QACR,IAAI,YAAY,KAAK,IAAI,EAAE;YACvB,OAAO,YAAY,CAAC;SACvB;QAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,uCAAuC,EAAE,CAAC,CAAC;QACnF,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAEtC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAEzB,4DAA4D;QAC5D,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAE3D,OAAO,YAAY,CAAC;IACxB,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { TLoadWorkerTimersFunction } from './load-worker-timers-function';
|
|
2
|
-
import { TWorkerTimers } from './worker-timers';
|
|
3
|
-
export declare type TLoadWorkerTimersFactory = (load: (url: string) => TWorkerTimers, worker: string) => TLoadWorkerTimersFunction;
|
|
4
|
-
//# sourceMappingURL=load-worker-timers-factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-worker-timers-factory.d.ts","sourceRoot":"","sources":["../../../src/types/load-worker-timers-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,oBAAY,wBAAwB,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,aAAa,EAAE,MAAM,EAAE,MAAM,KAAK,yBAAyB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-worker-timers-factory.js","sourceRoot":"","sources":["../../../src/types/load-worker-timers-factory.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-worker-timers-function.d.ts","sourceRoot":"","sources":["../../../src/types/load-worker-timers-function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,oBAAY,yBAAyB,GAAG,MAAM,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-worker-timers-function.js","sourceRoot":"","sources":["../../../src/types/load-worker-timers-function.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker-timers.d.ts","sourceRoot":"","sources":["../../../src/types/worker-timers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,oBAAY,aAAa,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker-timers.js","sourceRoot":"","sources":["../../../src/types/worker-timers.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { TLoadWorkerTimersFactory, TWorkerTimers } from '../types';
|
|
2
|
-
|
|
3
|
-
let workerTimers: null | TWorkerTimers = null;
|
|
4
|
-
|
|
5
|
-
export const createLoadWorkerTimers: TLoadWorkerTimersFactory = (load, worker) => {
|
|
6
|
-
return () => {
|
|
7
|
-
if (workerTimers !== null) {
|
|
8
|
-
return workerTimers;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
|
|
12
|
-
const url = URL.createObjectURL(blob);
|
|
13
|
-
|
|
14
|
-
workerTimers = load(url);
|
|
15
|
-
|
|
16
|
-
// Bug #1: Edge doesn't like the URL to be revoked directly.
|
|
17
|
-
workerTimers.setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
18
|
-
|
|
19
|
-
return workerTimers;
|
|
20
|
-
};
|
|
21
|
-
};
|
package/src/types/index.ts
DELETED