worker-timers-broker
Advanced tools
Comparing version 6.0.76 to 6.0.77
@@ -18,5 +18,3 @@ (function (global, factory) { | ||
var scheduledIntervalFunctions = new Map([[0, function () {}]]); // tslint:disable-line no-empty | ||
var scheduledTimeoutFunctions = new Map([[0, function () {}]]); // tslint:disable-line no-empty | ||
var unrespondedRequests = new Map(); | ||
@@ -26,14 +24,10 @@ var worker = new Worker(url); | ||
var data = _ref.data; | ||
if (isCallNotification(data)) { | ||
var _data$params = data.params, | ||
timerId = _data$params.timerId, | ||
timerType = _data$params.timerType; | ||
timerId = _data$params.timerId, | ||
timerType = _data$params.timerType; | ||
if (timerType === 'interval') { | ||
var idOrFunc = scheduledIntervalFunctions.get(timerId); | ||
if (typeof idOrFunc === 'number') { | ||
var timerIdAndTimerType = unrespondedRequests.get(idOrFunc); | ||
if (timerIdAndTimerType === undefined || timerIdAndTimerType.timerId !== timerId || timerIdAndTimerType.timerType !== timerType) { | ||
@@ -49,6 +43,4 @@ throw new Error('The timer is in an undefined state.'); | ||
var _idOrFunc = scheduledTimeoutFunctions.get(timerId); | ||
if (typeof _idOrFunc === 'number') { | ||
var _timerIdAndTimerType = unrespondedRequests.get(_idOrFunc); | ||
if (_timerIdAndTimerType === undefined || _timerIdAndTimerType.timerId !== timerId || _timerIdAndTimerType.timerType !== timerType) { | ||
@@ -58,5 +50,4 @@ throw new Error('The timer is in an undefined state.'); | ||
} else if (typeof _idOrFunc !== 'undefined') { | ||
_idOrFunc(); // A timeout can be savely deleted because it is only called once. | ||
_idOrFunc(); | ||
// A timeout can be savely deleted because it is only called once. | ||
scheduledTimeoutFunctions["delete"](timerId); | ||
@@ -69,13 +60,9 @@ } else { | ||
var id = data.id; | ||
var _timerIdAndTimerType2 = unrespondedRequests.get(id); | ||
if (_timerIdAndTimerType2 === undefined) { | ||
throw new Error('The timer is in an undefined state.'); | ||
} | ||
var _timerId = _timerIdAndTimerType2.timerId, | ||
_timerType = _timerIdAndTimerType2.timerType; | ||
_timerType = _timerIdAndTimerType2.timerType; | ||
unrespondedRequests["delete"](id); | ||
if (_timerType === 'interval') { | ||
@@ -91,3 +78,2 @@ scheduledIntervalFunctions["delete"](_timerId); | ||
}); | ||
var clearInterval = function clearInterval(timerId) { | ||
@@ -109,3 +95,2 @@ var id = fastUniqueNumbers.generateUniqueNumber(unrespondedRequests); | ||
}; | ||
var clearTimeout = function clearTimeout(timerId) { | ||
@@ -127,8 +112,7 @@ var id = fastUniqueNumbers.generateUniqueNumber(unrespondedRequests); | ||
}; | ||
var setInterval = function setInterval(func, delay) { | ||
var timerId = fastUniqueNumbers.generateUniqueNumber(scheduledIntervalFunctions); | ||
scheduledIntervalFunctions.set(timerId, function () { | ||
func(); // Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func(). | ||
func(); | ||
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func(). | ||
if (typeof scheduledIntervalFunctions.get(timerId) === 'function') { | ||
@@ -159,3 +143,2 @@ worker.postMessage({ | ||
}; | ||
var setTimeout = function setTimeout(func, delay) { | ||
@@ -176,3 +159,2 @@ var timerId = fastUniqueNumbers.generateUniqueNumber(scheduledTimeoutFunctions); | ||
}; | ||
return { | ||
@@ -179,0 +161,0 @@ clearInterval: clearInterval, |
@@ -12,13 +12,13 @@ { | ||
"dependencies": { | ||
"@babel/runtime": "^7.19.0", | ||
"fast-unique-numbers": "^6.0.21", | ||
"@babel/runtime": "^7.19.4", | ||
"fast-unique-numbers": "^6.0.22", | ||
"tslib": "^2.4.0", | ||
"worker-timers-worker": "^7.0.42" | ||
"worker-timers-worker": "^7.0.43" | ||
}, | ||
"description": "The broker which is used by the worker-timers package.", | ||
"devDependencies": { | ||
"@babel/core": "^7.19.0", | ||
"@babel/core": "^7.19.6", | ||
"@babel/plugin-external-helpers": "^7.18.6", | ||
"@babel/plugin-transform-runtime": "^7.18.10", | ||
"@babel/preset-env": "^7.19.0", | ||
"@babel/plugin-transform-runtime": "^7.19.6", | ||
"@babel/preset-env": "^7.19.4", | ||
"@commitlint/cli": "^17.1.2", | ||
@@ -30,4 +30,4 @@ "@commitlint/config-angular": "^17.1.0", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.23.0", | ||
"eslint-config-holy-grail": "^52.0.32", | ||
"eslint": "^8.26.0", | ||
"eslint-config-holy-grail": "^52.0.33", | ||
"grunt": "^1.5.3", | ||
@@ -37,3 +37,3 @@ "grunt-cli": "^1.4.3", | ||
"husky": "^8.0.1", | ||
"karma": "^6.4.0", | ||
"karma": "^6.4.1", | ||
"karma-chrome-launcher": "^3.1.1", | ||
@@ -47,14 +47,14 @@ "karma-firefox-launcher": "^2.1.2", | ||
"load-grunt-config": "^4.0.1", | ||
"mocha": "^10.0.0", | ||
"mocha": "^10.1.0", | ||
"prettier": "^2.7.1", | ||
"pretty-quick": "^3.1.3", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.79.0", | ||
"sinon": "^14.0.0", | ||
"rollup": "^2.79.1", | ||
"sinon": "^14.0.1", | ||
"sinon-chai": "^3.7.0", | ||
"ts-loader": "^9.3.1", | ||
"ts-loader": "^9.4.1", | ||
"tsconfig-holy-grail": "^11.1.36", | ||
"tslint": "^6.1.3", | ||
"tslint-config-holy-grail": "^53.2.33", | ||
"typescript": "^4.8.2", | ||
"typescript": "^4.8.4", | ||
"webpack": "^5.74.0" | ||
@@ -82,3 +82,3 @@ }, | ||
"types": "build/es2019/module.d.ts", | ||
"version": "6.0.76" | ||
"version": "6.0.77" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
469
29174
Updated@babel/runtime@^7.19.4
Updatedfast-unique-numbers@^6.0.22
Updatedworker-timers-worker@^7.0.43