Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

worker-timers

Package Overview
Dependencies
Maintainers
1
Versions
272
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

worker-timers - npm Package Compare versions

Comparing version
7.0.56
to
7.0.57
+2
build/es2019/factories/load-or-return-broker.d.ts
export declare const createLoadOrReturnBroker: <Broker>(loadBroker: (url: string) => Broker, worker: string) => () => Broker;
//# sourceMappingURL=load-or-return-broker.d.ts.map
{"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"}
export const createLoadOrReturnBroker = (loadBroker, worker) => {
let broker = null;
return () => {
if (broker !== null) {
return broker;
}
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
const url = URL.createObjectURL(blob);
broker = loadBroker(url);
// Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
setTimeout(() => URL.revokeObjectURL(url));
return broker;
};
};
//# sourceMappingURL=load-or-return-broker.js.map
{"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"}
export const createLoadOrReturnBroker = <Broker>(loadBroker: (url: string) => Broker, worker: string) => {
let broker: null | Broker = null;
return () => {
if (broker !== null) {
return broker;
}
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
const url = URL.createObjectURL(blob);
broker = loadBroker(url);
// Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
setTimeout(() => URL.revokeObjectURL(url));
return broker;
};
};
+5
-6

@@ -1,7 +0,6 @@

export * from './types/index';
import { TWorkerTimers } from './types';
export declare const clearInterval: TWorkerTimers['clearInterval'];
export declare const clearTimeout: TWorkerTimers['clearTimeout'];
export declare const setInterval: TWorkerTimers['setInterval'];
export declare const setTimeout: TWorkerTimers['setTimeout'];
import { load } from 'worker-timers-broker';
export declare const clearInterval: ReturnType<typeof load>['clearInterval'];
export declare const clearTimeout: ReturnType<typeof load>['clearTimeout'];
export declare const setInterval: ReturnType<typeof load>['setInterval'];
export declare const setTimeout: ReturnType<typeof load>['setTimeout'];
//# sourceMappingURL=module.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAQA,cAAc,eAAe,CAAC;AAI9B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,eAAe,CAA0D,CAAC;AAEpH,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,cAAc,CAAyD,CAAC;AAEjH,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,aAAa,CAAgE,CAAC;AAEtH,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,YAAY,CAA+D,CAAC"}
{"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"}
import { load } from 'worker-timers-broker';
import { createLoadWorkerTimers } from './factories/load-worker-timers';
import { createLoadOrReturnBroker } from './factories/load-or-return-broker';
import { worker } from './worker/worker';
/*
* @todo Explicitly referencing the barrel file seems to be necessary when enabling the
* isolatedModules compiler option.
*/
export * from './types/index';
const loadWorkerTimers = createLoadWorkerTimers(load, worker);
export const clearInterval = (timerId) => loadWorkerTimers().clearInterval(timerId);
export const clearTimeout = (timerId) => loadWorkerTimers().clearTimeout(timerId);
export const setInterval = (func, delay) => loadWorkerTimers().setInterval(func, delay);
export const setTimeout = (func, delay) => loadWorkerTimers().setTimeout(func, delay);
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
export const clearInterval = (timerId) => loadOrReturnBroker().clearInterval(timerId);
export const clearTimeout = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
export const setInterval = (func, delay) => loadOrReturnBroker().setInterval(func, delay);
export const setTimeout = (func, delay) => loadOrReturnBroker().setTimeout(func, delay);
//# sourceMappingURL=module.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACx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,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"}

@@ -7,7 +7,7 @@ (function (global, factory) {

var workerTimers = null;
var createLoadWorkerTimers = function createLoadWorkerTimers(load, worker) {
var createLoadOrReturnBroker = function createLoadOrReturnBroker(loadBroker, worker) {
var broker = null;
return function () {
if (workerTimers !== null) {
return workerTimers;
if (broker !== null) {
return broker;
}

@@ -18,8 +18,8 @@ var blob = new Blob([worker], {

var url = URL.createObjectURL(blob);
workerTimers = load(url);
// Bug #1: Edge doesn't like the URL to be revoked directly.
workerTimers.setTimeout(function () {
broker = loadBroker(url);
// Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
setTimeout(function () {
return URL.revokeObjectURL(url);
}, 0);
return workerTimers;
});
return broker;
};

@@ -31,14 +31,14 @@ };

var loadWorkerTimers = createLoadWorkerTimers(workerTimersBroker.load, worker);
var loadOrReturnBroker = createLoadOrReturnBroker(workerTimersBroker.load, worker);
var clearInterval = function clearInterval(timerId) {
return loadWorkerTimers().clearInterval(timerId);
return loadOrReturnBroker().clearInterval(timerId);
};
var clearTimeout = function clearTimeout(timerId) {
return loadWorkerTimers().clearTimeout(timerId);
return loadOrReturnBroker().clearTimeout(timerId);
};
var setInterval = function setInterval(func, delay) {
return loadWorkerTimers().setInterval(func, delay);
return loadOrReturnBroker().setInterval(func, delay);
};
var setTimeout = function setTimeout(func, delay) {
return loadWorkerTimers().setTimeout(func, delay);
var setTimeout$1 = function setTimeout(func, delay) {
return loadOrReturnBroker().setTimeout(func, delay);
};

@@ -49,3 +49,3 @@

exports.setInterval = setInterval;
exports.setTimeout = setTimeout;
exports.setTimeout = setTimeout$1;

@@ -52,0 +52,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

@@ -18,4 +18,4 @@ {

"dependencies": {
"@babel/runtime": "^7.19.4",
"tslib": "^2.4.0",
"@babel/runtime": "^7.20.1",
"tslib": "^2.4.1",
"worker-timers-broker": "^6.0.77",

@@ -26,2 +26,3 @@ "worker-timers-worker": "^7.0.43"

"devDependencies": {
"@babel/cli": "^7.19.3",
"@babel/core": "^7.19.6",

@@ -31,7 +32,8 @@ "@babel/plugin-external-helpers": "^7.18.6",

"@babel/preset-env": "^7.19.4",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-angular": "^17.1.0",
"@babel/register": "^7.18.9",
"@commitlint/cli": "^17.2.0",
"@commitlint/config-angular": "^17.2.0",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-replace": "^4.0.0",
"babel-loader": "^8.2.5",
"babel-loader": "^8.3.0",
"chai": "^4.3.6",

@@ -55,4 +57,4 @@ "commitizen": "^4.2.5",

"load-grunt-config": "^4.0.1",
"memfs": "^3.4.7",
"mocha": "^9.2.2",
"memfs": "^3.4.10",
"mocha": "^10.1.0",
"prettier": "^2.7.1",

@@ -102,3 +104,3 @@ "pretty-quick": "^3.1.3",

"types": "build/es2019/module.d.ts",
"version": "7.0.56"
"version": "7.0.57"
}
import { load } from 'worker-timers-broker';
import { createLoadWorkerTimers } from './factories/load-worker-timers';
import { createLoadOrReturnBroker } from './factories/load-or-return-broker';
import { worker } from './worker/worker';
/*
* @todo Explicitly referencing the barrel file seems to be necessary when enabling the
* isolatedModules compiler option.
*/
export * from './types/index';
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
const loadWorkerTimers = createLoadWorkerTimers(load, worker);
export const clearInterval: ReturnType<typeof load>['clearInterval'] = (timerId) => loadOrReturnBroker().clearInterval(timerId);
import { TWorkerTimers } from './types';
export const clearTimeout: ReturnType<typeof load>['clearTimeout'] = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
export const clearInterval: TWorkerTimers['clearInterval'] = (timerId) => loadWorkerTimers().clearInterval(timerId);
export const setInterval: ReturnType<typeof load>['setInterval'] = (func, delay) => loadOrReturnBroker().setInterval(func, delay);
export const clearTimeout: TWorkerTimers['clearTimeout'] = (timerId) => loadWorkerTimers().clearTimeout(timerId);
export const setInterval: TWorkerTimers['setInterval'] = (func, delay) => loadWorkerTimers().setInterval(func, delay);
export const setTimeout: TWorkerTimers['setTimeout'] = (func, delay) => loadWorkerTimers().setTimeout(func, delay);
export const setTimeout: ReturnType<typeof load>['setTimeout'] = (func, delay) => loadOrReturnBroker().setTimeout(func, delay);
import { TLoadWorkerTimersFactory } from '../types';
export declare const createLoadWorkerTimers: TLoadWorkerTimersFactory;
//# sourceMappingURL=load-worker-timers.d.ts.map
{"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"}
let workerTimers = null;
export const createLoadWorkerTimers = (load, worker) => {
return () => {
if (workerTimers !== null) {
return workerTimers;
}
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
const url = URL.createObjectURL(blob);
workerTimers = load(url);
// Bug #1: Edge doesn't like the URL to be revoked directly.
workerTimers.setTimeout(() => URL.revokeObjectURL(url), 0);
return workerTimers;
};
};
//# sourceMappingURL=load-worker-timers.js.map
{"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"}
export * from './load-worker-timers-factory';
export * from './load-worker-timers-function';
export * from './worker-timers';
//# sourceMappingURL=index.d.ts.map
{"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"}
export * from './load-worker-timers-factory';
export * from './load-worker-timers-function';
export * from './worker-timers';
//# sourceMappingURL=index.js.map
{"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"}
import { TLoadWorkerTimersFunction } from './load-worker-timers-function';
import { TWorkerTimers } from './worker-timers';
export declare type TLoadWorkerTimersFactory = (load: (url: string) => TWorkerTimers, worker: string) => TLoadWorkerTimersFunction;
//# sourceMappingURL=load-worker-timers-factory.d.ts.map
{"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"}
export {};
//# sourceMappingURL=load-worker-timers-factory.js.map
{"version":3,"file":"load-worker-timers-factory.js","sourceRoot":"","sources":["../../../src/types/load-worker-timers-factory.ts"],"names":[],"mappings":""}
import { TWorkerTimers } from './worker-timers';
export declare type TLoadWorkerTimersFunction = () => TWorkerTimers;
//# sourceMappingURL=load-worker-timers-function.d.ts.map
{"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"}
export {};
//# sourceMappingURL=load-worker-timers-function.js.map
{"version":3,"file":"load-worker-timers-function.js","sourceRoot":"","sources":["../../../src/types/load-worker-timers-function.ts"],"names":[],"mappings":""}
import { load } from 'worker-timers-broker';
export declare type TWorkerTimers = ReturnType<typeof load>;
//# sourceMappingURL=worker-timers.d.ts.map
{"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"}
export {};
//# sourceMappingURL=worker-timers.js.map
{"version":3,"file":"worker-timers.js","sourceRoot":"","sources":["../../../src/types/worker-timers.ts"],"names":[],"mappings":""}
import { TLoadWorkerTimersFactory, TWorkerTimers } from '../types';
let workerTimers: null | TWorkerTimers = null;
export const createLoadWorkerTimers: TLoadWorkerTimersFactory = (load, worker) => {
return () => {
if (workerTimers !== null) {
return workerTimers;
}
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
const url = URL.createObjectURL(blob);
workerTimers = load(url);
// Bug #1: Edge doesn't like the URL to be revoked directly.
workerTimers.setTimeout(() => URL.revokeObjectURL(url), 0);
return workerTimers;
};
};
export * from './load-worker-timers-factory';
export * from './load-worker-timers-function';
export * from './worker-timers';
import { TLoadWorkerTimersFunction } from './load-worker-timers-function';
import { TWorkerTimers } from './worker-timers';
export type TLoadWorkerTimersFactory = (load: (url: string) => TWorkerTimers, worker: string) => TLoadWorkerTimersFunction;
import { TWorkerTimers } from './worker-timers';
export type TLoadWorkerTimersFunction = () => TWorkerTimers;
import { load } from 'worker-timers-broker';
export type TWorkerTimers = ReturnType<typeof load>;