Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

worker-timers-worker

Package Overview
Dependencies
Maintainers
1
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

worker-timers-worker - npm Package Compare versions

Comparing version 6.0.10 to 6.0.11

4

build/es2019/helpers/timer.js

@@ -40,3 +40,3 @@ const scheduledIntervalIdentifiers = new Map();

const setTimeoutCallback = (identifiers, timerId, expected, timerType) => {
const now = ('performance' in self) ? performance.now() : Date.now();
const now = 'performance' in self ? performance.now() : Date.now();
if (now > expected) {

@@ -46,3 +46,3 @@ postMessage({ id: null, method: 'call', params: { timerId, timerType } });

else {
identifiers.set(timerId, setTimeout(setTimeoutCallback, (expected - now), identifiers, timerId, expected, timerType));
identifiers.set(timerId, setTimeout(setTimeoutCallback, expected - now, identifiers, timerId, expected, timerType));
}

@@ -49,0 +49,0 @@ };

{
"author": "Christoph Guttandin",
"bugs": {
"url": "https://github.com/chrisguttandin/worker-timers-worker/issues"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"dependencies": {
"@babel/runtime": "^7.10.2",
"tslib": "^2.0.0"
},
"description": "The worker which is used by the worker-timers package.",
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/plugin-external-helpers": "^7.10.1",
"@babel/plugin-transform-runtime": "^7.10.1",
"@babel/preset-env": "^7.10.2",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-angular": "^8.3.4",
"chai": "^4.2.0",
"commitizen": "^4.1.2",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^7.1.0",
"eslint-config-holy-grail": "^47.0.1",
"grunt": "^1.1.0",
"grunt-cli": "^1.3.2",
"grunt-contrib-clean": "^2.0.0",
"grunt-sh": "^0.2.0",
"husky": "^4.2.5",
"karma": "^5.0.9",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-firefox-launcher": "^1.3.0",
"karma-mocha": "^2.0.1",
"karma-mocha-webworker": "^1.3.0",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^4.1.5",
"karma-sinon-chai": "^2.0.2",
"karma-webpack": "^4.0.2",
"load-grunt-config": "^3.0.1",
"mocha": "^7.2.0",
"rollup": "^2.13.1",
"rollup-plugin-babel": "^4.4.0",
"sinon": "^9.0.2",
"sinon-chai": "^3.5.0",
"ts-loader": "^7.0.5",
"tsconfig-holy-grail": "^11.0.14",
"tslint": "^6.1.2",
"tslint-config-holy-grail": "^50.0.1",
"typescript": "^3.9.5",
"webpack": "^4.43.0"
},
"files": [
"build/es2019/",
"build/es5/",
"src/"
],
"homepage": "https://github.com/chrisguttandin/worker-timers-worker",
"husky": {
"hooks": {
"commit-msg": "commitlint --edit --extends @commitlint/config-angular",
"pre-commit": "grunt lint"
}
},
"license": "MIT",
"main": "build/es5/bundle.js",
"module": "build/es2019/module.js",
"name": "worker-timers-worker",
"repository": {
"type": "git",
"url": "https://github.com/chrisguttandin/worker-timers-worker.git"
},
"scripts": {
"prepublishOnly": "grunt build",
"test": "grunt lint && grunt test"
},
"types": "build/es2019/module.d.ts",
"version": "6.0.10"
"author": "Christoph Guttandin",
"bugs": {
"url": "https://github.com/chrisguttandin/worker-timers-worker/issues"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"dependencies": {
"@babel/runtime": "^7.10.3",
"tslib": "^2.0.0"
},
"description": "The worker which is used by the worker-timers package.",
"devDependencies": {
"@babel/core": "^7.10.3",
"@babel/plugin-external-helpers": "^7.10.1",
"@babel/plugin-transform-runtime": "^7.10.3",
"@babel/preset-env": "^7.10.3",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-angular": "^8.3.4",
"chai": "^4.2.0",
"commitizen": "^4.1.2",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^7.2.0",
"eslint-config-holy-grail": "^47.0.5",
"grunt": "^1.1.0",
"grunt-cli": "^1.3.2",
"grunt-contrib-clean": "^2.0.0",
"grunt-sh": "^0.2.0",
"husky": "^4.2.5",
"karma": "^5.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-firefox-launcher": "^1.3.0",
"karma-mocha": "^2.0.1",
"karma-mocha-webworker": "^1.3.0",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^4.1.5",
"karma-sinon-chai": "^2.0.2",
"karma-webpack": "^4.0.2",
"load-grunt-config": "^3.0.1",
"mocha": "^8.0.1",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"rollup": "^2.17.1",
"rollup-plugin-babel": "^4.4.0",
"sinon": "^9.0.2",
"sinon-chai": "^3.5.0",
"ts-loader": "^7.0.5",
"tsconfig-holy-grail": "^11.0.16",
"tslint": "^6.1.2",
"tslint-config-holy-grail": "^50.0.4",
"typescript": "^3.9.5",
"webpack": "^4.43.0"
},
"files": [
"build/es2019/",
"build/es5/",
"src/"
],
"homepage": "https://github.com/chrisguttandin/worker-timers-worker",
"husky": {
"hooks": {
"commit-msg": "commitlint --edit --extends @commitlint/config-angular",
"pre-commit": "pretty-quick --config config/prettier/config.json --staged && grunt lint"
}
},
"license": "MIT",
"main": "build/es5/bundle.js",
"module": "build/es2019/module.js",
"name": "worker-timers-worker",
"repository": {
"type": "git",
"url": "https://github.com/chrisguttandin/worker-timers-worker.git"
},
"scripts": {
"prepublishOnly": "grunt build",
"test": "grunt lint && grunt test"
},
"types": "build/es2019/module.d.ts",
"version": "6.0.11"
}

@@ -13,3 +13,3 @@ import { ICallNotification } from '../interfaces';

} else {
throw new Error(`There is no interval scheduled with the given id "${ timerId }".`);
throw new Error(`There is no interval scheduled with the given id "${timerId}".`);
}

@@ -25,3 +25,3 @@ };

} else {
throw new Error(`There is no timeout scheduled with the given id "${ timerId }".`);
throw new Error(`There is no timeout scheduled with the given id "${timerId}".`);
}

@@ -51,8 +51,8 @@ };

const setTimeoutCallback = (identifiers: Map<number, number>, timerId: number, expected: number, timerType: string) => {
const now = ('performance' in self) ? performance.now() : Date.now();
const now = 'performance' in self ? performance.now() : Date.now();
if (now > expected) {
postMessage(<ICallNotification> { id: null, method: 'call', params: { timerId, timerType } });
postMessage(<ICallNotification>{ id: null, method: 'call', params: { timerId, timerType } });
} else {
identifiers.set(timerId, setTimeout(setTimeoutCallback, (expected - now), identifiers, timerId, expected, timerType));
identifiers.set(timerId, setTimeout(setTimeoutCallback, expected - now, identifiers, timerId, expected, timerType));
}

@@ -65,3 +65,4 @@ };

scheduledIntervalIdentifiers.set(
timerId, setTimeout(setTimeoutCallback, remainingDelay, scheduledIntervalIdentifiers, timerId, expected, 'interval')
timerId,
setTimeout(setTimeoutCallback, remainingDelay, scheduledIntervalIdentifiers, timerId, expected, 'interval')
);

@@ -74,4 +75,5 @@ };

scheduledTimeoutIdentifiers.set(
timerId, setTimeout(setTimeoutCallback, remainingDelay, scheduledTimeoutIdentifiers, timerId, expected, 'timeout')
timerId,
setTimeout(setTimeoutCallback, remainingDelay, scheduledTimeoutIdentifiers, timerId, expected, 'timeout')
);
};
import { TBrokerMessage } from '../types';
export interface IBrokerEvent extends Event {
data: TBrokerMessage;
}
import { TTimerType } from '../types';
export interface ICallNotification {
id: null;

@@ -10,9 +9,6 @@

params: {
timerId: number;
timerType: TTimerType;
};
}
import { TTimerType } from '../types';
export interface IClearRequest {
id: number;

@@ -10,9 +9,6 @@

params: {
timerId: number;
timerType: TTimerType;
};
}
export interface IClearResponse {
error: null;
id: number;
}
export interface IErrorNotification {
error: {
message: string;
};

@@ -12,3 +9,2 @@

result: null;
}
export interface IErrorResponse {
error: {
message: string;
};

@@ -12,3 +9,2 @@

result: null;
}
import { TTimerType } from '../types';
export interface ISetNotification {
id: null;

@@ -10,3 +9,2 @@

params: {
delay: number;

@@ -19,5 +17,3 @@

timerType: TTimerType;
};
}
import { TWorkerMessage } from '../types';
export interface IWorkerEvent extends Event {
data: TWorkerMessage;
}

@@ -14,3 +14,6 @@ import { clearScheduledInterval, clearScheduledTimeout, scheduleInterval, scheduleTimeout } from './helpers/timer';

if (data.method === 'clear') {
const { id, params: { timerId, timerType } } = data;
const {
id,
params: { timerId, timerType }
} = data;

@@ -20,12 +23,14 @@ if (timerType === 'interval') {

postMessage(<IClearResponse> { error: null, id });
postMessage(<IClearResponse>{ error: null, id });
} else if (timerType === 'timeout') {
clearScheduledTimeout(timerId);
postMessage(<IClearResponse> { error: null, id });
postMessage(<IClearResponse>{ error: null, id });
} else {
throw new Error(`The given type "${ timerType }" is not supported`);
throw new Error(`The given type "${timerType}" is not supported`);
}
} else if (data.method === 'set') {
const { params: { delay, now, timerId, timerType } } = data;
const {
params: { delay, now, timerId, timerType }
} = data;

@@ -37,9 +42,9 @@ if (timerType === 'interval') {

} else {
throw new Error(`The given type "${ timerType }" is not supported`);
throw new Error(`The given type "${timerType}" is not supported`);
}
} else {
throw new Error(`The given method "${ (<any> data).method }" is not supported`);
throw new Error(`The given method "${(<any>data).method}" is not supported`);
}
} catch (err) {
postMessage(<IErrorNotification | IErrorResponse> {
postMessage(<IErrorNotification | IErrorResponse>{
error: {

@@ -46,0 +51,0 @@ message: err.message

{
"compilerOptions": {
"isolatedModules": true
},
"extends": "tsconfig-holy-grail/src/tsconfig-web-worker"
"compilerOptions": {
"isolatedModules": true
},
"extends": "tsconfig-holy-grail/src/tsconfig-web-worker"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc