worker-timers-worker
Advanced tools
Comparing version 6.0.18 to 7.0.0
@@ -26,12 +26,6 @@ const scheduledIntervalIdentifiers = new Map(); | ||
let remainingDelay; | ||
if ('performance' in self) { | ||
const nowInWorker = performance.now(); | ||
const elapsed = Math.max(0, nowInWorker - nowInMainThread); | ||
now = nowInWorker; | ||
remainingDelay = delay - elapsed; | ||
} | ||
else { | ||
now = Date.now(); | ||
remainingDelay = delay; | ||
} | ||
const nowInWorker = performance.now(); | ||
const elapsed = Math.max(0, nowInWorker - nowInMainThread); | ||
now = nowInWorker; | ||
remainingDelay = delay - elapsed; | ||
const expected = now + remainingDelay; | ||
@@ -41,3 +35,3 @@ return { expected, remainingDelay }; | ||
const setTimeoutCallback = (identifiers, timerId, expected, timerType) => { | ||
const now = 'performance' in self ? performance.now() : Date.now(); | ||
const now = performance.now(); | ||
if (now > expected) { | ||
@@ -44,0 +38,0 @@ postMessage({ id: null, method: 'call', params: { timerId, timerType } }); |
@@ -32,13 +32,6 @@ (function (factory) { | ||
var remainingDelay; | ||
if ('performance' in self) { | ||
var nowInWorker = performance.now(); | ||
var elapsed = Math.max(0, nowInWorker - nowInMainThread); | ||
now = nowInWorker; | ||
remainingDelay = delay - elapsed; | ||
} else { | ||
now = Date.now(); | ||
remainingDelay = delay; | ||
} | ||
var nowInWorker = performance.now(); | ||
var elapsed = Math.max(0, nowInWorker - nowInMainThread); | ||
now = nowInWorker; | ||
remainingDelay = delay - elapsed; | ||
var expected = now + remainingDelay; | ||
@@ -52,3 +45,3 @@ return { | ||
var setTimeoutCallback = function setTimeoutCallback(identifiers, timerId, expected, timerType) { | ||
var now = 'performance' in self ? performance.now() : Date.now(); | ||
var now = performance.now(); | ||
@@ -55,0 +48,0 @@ if (now > expected) { |
@@ -11,2 +11,8 @@ { | ||
}, | ||
"contributors": [ | ||
{ | ||
"email": "vac872089248@gmail.com", | ||
"name": "Knissing" | ||
} | ||
], | ||
"dependencies": { | ||
@@ -27,3 +33,3 @@ "@babel/runtime": "^7.11.2", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^7.8.1", | ||
"eslint": "^7.9.0", | ||
"eslint-config-holy-grail": "^48.0.0", | ||
@@ -34,4 +40,4 @@ "grunt": "^1.3.0", | ||
"grunt-sh": "^0.2.0", | ||
"husky": "^4.2.5", | ||
"karma": "^5.2.1", | ||
"husky": "^4.3.0", | ||
"karma": "^5.2.2", | ||
"karma-chrome-launcher": "^3.1.0", | ||
@@ -48,14 +54,14 @@ "karma-cli": "^2.0.0", | ||
"mocha": "^8.1.3", | ||
"prettier": "^2.1.1", | ||
"pretty-quick": "^3.0.0", | ||
"rollup": "^2.26.10", | ||
"prettier": "^2.1.2", | ||
"pretty-quick": "^3.0.2", | ||
"rollup": "^2.28.1", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"sinon": "^9.0.3", | ||
"sinon-chai": "^3.5.0", | ||
"ts-loader": "^8.0.3", | ||
"tsconfig-holy-grail": "^11.0.21", | ||
"ts-loader": "^8.0.4", | ||
"tsconfig-holy-grail": "^11.0.27", | ||
"tslint": "^6.1.3", | ||
"tslint-config-holy-grail": "^52.0.11", | ||
"typescript": "^4.0.2", | ||
"webpack": "^4.44.1" | ||
"tslint-config-holy-grail": "^52.0.14", | ||
"typescript": "^4.0.3", | ||
"webpack": "^4.44.2" | ||
}, | ||
@@ -87,3 +93,3 @@ "files": [ | ||
"types": "build/es2019/module.d.ts", | ||
"version": "6.0.18" | ||
"version": "7.0.0" | ||
} |
@@ -31,14 +31,8 @@ import { ICallNotification } from '../interfaces'; | ||
let remainingDelay: number; | ||
const nowInWorker = performance.now(); | ||
const elapsed = Math.max(0, nowInWorker - nowInMainThread); | ||
if ('performance' in self) { | ||
const nowInWorker = performance.now(); | ||
const elapsed = Math.max(0, nowInWorker - nowInMainThread); | ||
now = nowInWorker; | ||
remainingDelay = delay - elapsed; | ||
now = nowInWorker; | ||
remainingDelay = delay - elapsed; | ||
} else { | ||
now = Date.now(); | ||
remainingDelay = delay; | ||
} | ||
const expected = now + remainingDelay; | ||
@@ -50,3 +44,3 @@ | ||
const setTimeoutCallback = (identifiers: Map<number, number>, timerId: number, expected: number, timerType: string) => { | ||
const now = 'performance' in self ? performance.now() : Date.now(); | ||
const now = performance.now(); | ||
@@ -53,0 +47,0 @@ if (now > expected) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
32975
489