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

worker-timers

Package Overview
Dependencies
Maintainers
1
Versions
254
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 4.0.1 to 4.0.2

4

build/es2015/module.d.ts

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

export declare const clearInterval: (id: number) => void;
export declare const clearTimeout: (id: number) => void;
export declare const clearInterval: (timerId: number) => void;
export declare const clearTimeout: (timerId: number) => void;
export declare const setInterval: (func: Function, delay: number) => number;
export declare const setTimeout: (func: Function, delay: number) => number;

@@ -10,2 +10,2 @@ import { load } from 'worker-timers-broker';

export const setTimeout = workerTimers.setTimeout;
//# sourceMappingURL=module.js.map
//# sourceMappingURL=/users/chrisguttandin/repositories/worker-timers/node_modules/tsconfig-holy-grail/src/module.js.map
// tslint:disable-next-line:max-line-length
// tslint:disable-next-line:max-line-length
export const worker = `!function(){"use strict";var a=new Map,b=new Map,c=function a(b,c,d,e){var f="performance"in self?performance.now():Date.now();f>d?postMessage({id:c,type:e}):b.set(c,setTimeout(a,d-f,b,c,d,e))};addEventListener("message",function(d){var e=d.data,f=e.action,g=e.delay,h=e.id,i=e.now,j=e.type;if("clear"===f){var k=void 0;"interval"===j?void 0!==(k=a.get(h))&&(clearTimeout(k),a.delete(h)):"timeout"===j&&void 0!==(k=b.get(h))&&(clearTimeout(k),b.delete(h))}else if("set"===f){var l=void 0;if("performance"in self){var m=performance.now(),n=Math.max(0,m-i);g-=n,l=m}else l=Date.now();var o=l+g;"interval"===j?a.set(h,setTimeout(c,g,a,h,o,j)):"timeout"===j&&b.set(h,setTimeout(c,g,b,h,o,j))}})}();`;
//# sourceMappingURL=worker.js.map
export const worker = `!function(){"use strict";var a=new Map,b=new Map,c=function(b){var c=a.get(b);if(void 0===c)throw new Error('There is no interval scheduled with the given id "'+b+'".');clearTimeout(c),a.delete(b)},d=function(a){var c=b.get(a);if(void 0===c)throw new Error('There is no timeout scheduled with the given id "'+a+'".');clearTimeout(c),b.delete(a)},e=function(a,b){var c=void 0;if("performance"in self){var d=performance.now();a-=Math.max(0,d-b),c=d}else c=Date.now();return{delay:a,expected:c+a}},f=function a(b,c,d,e){var f="performance"in self?performance.now():Date.now();f>d?postMessage({id:null,method:"call",params:{timerId:c,timerType:e}}):b.set(c,setTimeout(a,d-f,b,c,d,e))},g=function(b,c,d){var g=void 0,h=e(b,d);b=h.delay,g=h.expected,a.set(c,setTimeout(f,b,a,c,g,"interval"))},h=function(a,c,d){var g=void 0,h=e(a,d);a=h.delay,g=h.expected,b.set(c,setTimeout(f,a,b,c,g,"timeout"))};addEventListener("message",function(a){var b=a.data;try{if("clear"===b.method){var e=b.id,f=b.params,i=f.timerId,j=f.timerType;if("interval"===j)c(i),postMessage({error:null,id:e});else{if("timeout"!==j)throw new Error('The given type "'+j+'" is not supported');d(i),postMessage({error:null,id:e})}}else{if("set"!==b.method)throw new Error('The given method "'+b.method+'" is not supported');var k=b.params,l=k.delay,m=k.now,n=k.timerId,o=k.timerType;if("interval"===o)g(l,n,m);else{if("timeout"!==o)throw new Error('The given type "'+o+'" is not supported');h(l,n,m)}}}catch(a){postMessage({err:{message:a.message}})}})}();`;
//# sourceMappingURL=/users/chrisguttandin/repositories/worker-timers/node_modules/tsconfig-holy-grail/src/worker/worker.js.map

@@ -9,3 +9,3 @@ (function (global, factory) {

// tslint:disable-next-line:max-line-length
var worker = "!function(){\"use strict\";var a=new Map,b=new Map,c=function a(b,c,d,e){var f=\"performance\"in self?performance.now():Date.now();f>d?postMessage({id:c,type:e}):b.set(c,setTimeout(a,d-f,b,c,d,e))};addEventListener(\"message\",function(d){var e=d.data,f=e.action,g=e.delay,h=e.id,i=e.now,j=e.type;if(\"clear\"===f){var k=void 0;\"interval\"===j?void 0!==(k=a.get(h))&&(clearTimeout(k),a.delete(h)):\"timeout\"===j&&void 0!==(k=b.get(h))&&(clearTimeout(k),b.delete(h))}else if(\"set\"===f){var l=void 0;if(\"performance\"in self){var m=performance.now(),n=Math.max(0,m-i);g-=n,l=m}else l=Date.now();var o=l+g;\"interval\"===j?a.set(h,setTimeout(c,g,a,h,o,j)):\"timeout\"===j&&b.set(h,setTimeout(c,g,b,h,o,j))}})}();";
var worker = "!function(){\"use strict\";var a=new Map,b=new Map,c=function(b){var c=a.get(b);if(void 0===c)throw new Error('There is no interval scheduled with the given id \"'+b+'\".');clearTimeout(c),a.delete(b)},d=function(a){var c=b.get(a);if(void 0===c)throw new Error('There is no timeout scheduled with the given id \"'+a+'\".');clearTimeout(c),b.delete(a)},e=function(a,b){var c=void 0;if(\"performance\"in self){var d=performance.now();a-=Math.max(0,d-b),c=d}else c=Date.now();return{delay:a,expected:c+a}},f=function a(b,c,d,e){var f=\"performance\"in self?performance.now():Date.now();f>d?postMessage({id:null,method:\"call\",params:{timerId:c,timerType:e}}):b.set(c,setTimeout(a,d-f,b,c,d,e))},g=function(b,c,d){var g=void 0,h=e(b,d);b=h.delay,g=h.expected,a.set(c,setTimeout(f,b,a,c,g,\"interval\"))},h=function(a,c,d){var g=void 0,h=e(a,d);a=h.delay,g=h.expected,b.set(c,setTimeout(f,a,b,c,g,\"timeout\"))};addEventListener(\"message\",function(a){var b=a.data;try{if(\"clear\"===b.method){var e=b.id,f=b.params,i=f.timerId,j=f.timerType;if(\"interval\"===j)c(i),postMessage({error:null,id:e});else{if(\"timeout\"!==j)throw new Error('The given type \"'+j+'\" is not supported');d(i),postMessage({error:null,id:e})}}else{if(\"set\"!==b.method)throw new Error('The given method \"'+b.method+'\" is not supported');var k=b.params,l=k.delay,m=k.now,n=k.timerId,o=k.timerType;if(\"interval\"===o)g(l,n,m);else{if(\"timeout\"!==o)throw new Error('The given type \"'+o+'\" is not supported');h(l,n,m)}}}catch(a){postMessage({err:{message:a.message}})}})}();";

@@ -12,0 +12,0 @@ var blob = new Blob([worker], { type: 'application/javascript' });

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

var isCallNotification = function isCallNotification(message) {
return message.method !== undefined;
};
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1;

@@ -19,70 +23,118 @@ var generateUniqueId = function generateUniqueId(map) {

var scheduledTimeoutFunctions = new Map();
var unrespondedRequests = new Map();
var worker = new Worker(url);
worker.addEventListener('message', function (_a) {
var _b = _a.data,
id = _b.id,
type = _b.type;
if (type === 'interval') {
var func = scheduledIntervalFunctions.get(id);
if (func) {
func();
var data = _a.data;
if (isCallNotification(data)) {
var _b = data.params,
timerId = _b.timerId,
timerType = _b.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) {
throw new Error('The timer is in an undefined state.');
}
} else if (typeof idOrFunc !== 'undefined') {
idOrFunc();
} else {
throw new Error('The timer is in an undefined state.');
}
} else if (timerType === 'timeout') {
var idOrFunc = scheduledTimeoutFunctions.get(timerId);
if (typeof idOrFunc === 'number') {
var timerIdAndTimerType = unrespondedRequests.get(idOrFunc);
if (timerIdAndTimerType === undefined || timerIdAndTimerType.timerId !== timerId || timerIdAndTimerType.timerType !== timerType) {
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.
scheduledTimeoutFunctions.delete(timerId);
} else {
throw new Error('The timer is in an undefined state.');
}
}
} else if (type === 'timeout') {
var func = scheduledTimeoutFunctions.get(id);
if (func) {
func();
// A timeout can be savely deleted because it is only called once.
scheduledTimeoutFunctions.delete(id);
} else {
var id = data.id;
var timerIdAndTimerType = unrespondedRequests.get(id);
if (timerIdAndTimerType === undefined) {
throw new Error('The timer is in an undefined state.');
} else {
var timerId = timerIdAndTimerType.timerId,
timerType = timerIdAndTimerType.timerType;
unrespondedRequests.delete(id);
if (timerType === 'interval') {
scheduledIntervalFunctions.delete(timerId);
} else {
scheduledTimeoutFunctions.delete(timerId);
}
}
}
// @todo Maybe throw an error.
});
var clearInterval = function clearInterval(id) {
scheduledIntervalFunctions.delete(id);
var clearInterval = function clearInterval(timerId) {
var id = generateUniqueId(unrespondedRequests);
unrespondedRequests.set(id, { timerId: timerId, timerType: 'interval' });
scheduledIntervalFunctions.set(timerId, id);
worker.postMessage({
action: 'clear',
id: id,
type: 'interval'
method: 'clear',
params: { timerId: timerId, timerType: 'interval' }
});
};
var clearTimeout = function clearTimeout(id) {
scheduledTimeoutFunctions.delete(id);
var clearTimeout = function clearTimeout(timerId) {
var id = generateUniqueId(unrespondedRequests);
unrespondedRequests.set(id, { timerId: timerId, timerType: 'timeout' });
scheduledTimeoutFunctions.set(timerId, id);
worker.postMessage({
action: 'clear',
id: id,
type: 'timeout'
method: 'clear',
params: { timerId: timerId, timerType: 'timeout' }
});
};
var setInterval = function setInterval(func, delay) {
var id = generateUniqueId(scheduledIntervalFunctions);
scheduledIntervalFunctions.set(id, function () {
var timerId = generateUniqueId(scheduledIntervalFunctions);
scheduledIntervalFunctions.set(timerId, function () {
func();
worker.postMessage({
action: 'set',
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
if (typeof scheduledIntervalFunctions.get(timerId) === 'function') {
worker.postMessage({
id: null,
method: 'set',
params: {
delay: delay,
now: performance.now(),
timerId: timerId,
timerType: 'interval'
}
});
}
});
worker.postMessage({
id: null,
method: 'set',
params: {
delay: delay,
id: id,
now: performance.now(),
type: 'interval'
});
timerId: timerId,
timerType: 'interval'
}
});
worker.postMessage({
action: 'set',
delay: delay,
id: id,
now: performance.now(),
type: 'interval'
});
return id;
return timerId;
};
var setTimeout = function setTimeout(func, delay) {
var id = generateUniqueId(scheduledTimeoutFunctions);
scheduledTimeoutFunctions.set(id, func);
var timerId = generateUniqueId(scheduledTimeoutFunctions);
scheduledTimeoutFunctions.set(timerId, func);
worker.postMessage({
action: 'set',
delay: delay,
id: id,
now: performance.now(),
type: 'timeout'
id: null,
method: 'set',
params: {
delay: delay,
now: performance.now(),
timerId: timerId,
timerType: 'timeout'
}
});
return id;
return timerId;
};

@@ -99,3 +151,3 @@ return {

// tslint:disable-next-line:max-line-length
var worker = "!function(){\"use strict\";var a=new Map,b=new Map,c=function a(b,c,d,e){var f=\"performance\"in self?performance.now():Date.now();f>d?postMessage({id:c,type:e}):b.set(c,setTimeout(a,d-f,b,c,d,e))};addEventListener(\"message\",function(d){var e=d.data,f=e.action,g=e.delay,h=e.id,i=e.now,j=e.type;if(\"clear\"===f){var k=void 0;\"interval\"===j?void 0!==(k=a.get(h))&&(clearTimeout(k),a.delete(h)):\"timeout\"===j&&void 0!==(k=b.get(h))&&(clearTimeout(k),b.delete(h))}else if(\"set\"===f){var l=void 0;if(\"performance\"in self){var m=performance.now(),n=Math.max(0,m-i);g-=n,l=m}else l=Date.now();var o=l+g;\"interval\"===j?a.set(h,setTimeout(c,g,a,h,o,j)):\"timeout\"===j&&b.set(h,setTimeout(c,g,b,h,o,j))}})}();";
var worker = "!function(){\"use strict\";var a=new Map,b=new Map,c=function(b){var c=a.get(b);if(void 0===c)throw new Error('There is no interval scheduled with the given id \"'+b+'\".');clearTimeout(c),a.delete(b)},d=function(a){var c=b.get(a);if(void 0===c)throw new Error('There is no timeout scheduled with the given id \"'+a+'\".');clearTimeout(c),b.delete(a)},e=function(a,b){var c=void 0;if(\"performance\"in self){var d=performance.now();a-=Math.max(0,d-b),c=d}else c=Date.now();return{delay:a,expected:c+a}},f=function a(b,c,d,e){var f=\"performance\"in self?performance.now():Date.now();f>d?postMessage({id:null,method:\"call\",params:{timerId:c,timerType:e}}):b.set(c,setTimeout(a,d-f,b,c,d,e))},g=function(b,c,d){var g=void 0,h=e(b,d);b=h.delay,g=h.expected,a.set(c,setTimeout(f,b,a,c,g,\"interval\"))},h=function(a,c,d){var g=void 0,h=e(a,d);a=h.delay,g=h.expected,b.set(c,setTimeout(f,a,b,c,g,\"timeout\"))};addEventListener(\"message\",function(a){var b=a.data;try{if(\"clear\"===b.method){var e=b.id,f=b.params,i=f.timerId,j=f.timerType;if(\"interval\"===j)c(i),postMessage({error:null,id:e});else{if(\"timeout\"!==j)throw new Error('The given type \"'+j+'\" is not supported');d(i),postMessage({error:null,id:e})}}else{if(\"set\"!==b.method)throw new Error('The given method \"'+b.method+'\" is not supported');var k=b.params,l=k.delay,m=k.now,n=k.timerId,o=k.timerType;if(\"interval\"===o)g(l,n,m);else{if(\"timeout\"!==o)throw new Error('The given type \"'+o+'\" is not supported');h(l,n,m)}}}catch(a){postMessage({err:{message:a.message}})}})}();";

@@ -102,0 +154,0 @@ var blob = new Blob([worker], { type: 'application/javascript' });

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

!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):b(a.workerTimers=a.workerTimers||{})}(this,function(a){"use strict";var b=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,c=function(a){for(var c=Math.round(Math.random()*b);a.has(c);)c=Math.round(Math.random()*b);return c},d=new Blob(['!function(){"use strict";var a=new Map,b=new Map,c=function a(b,c,d,e){var f="performance"in self?performance.now():Date.now();f>d?postMessage({id:c,type:e}):b.set(c,setTimeout(a,d-f,b,c,d,e))};addEventListener("message",function(d){var e=d.data,f=e.action,g=e.delay,h=e.id,i=e.now,j=e.type;if("clear"===f){var k=void 0;"interval"===j?void 0!==(k=a.get(h))&&(clearTimeout(k),a.delete(h)):"timeout"===j&&void 0!==(k=b.get(h))&&(clearTimeout(k),b.delete(h))}else if("set"===f){var l=void 0;if("performance"in self){var m=performance.now(),n=Math.max(0,m-i);g-=n,l=m}else l=Date.now();var o=l+g;"interval"===j?a.set(h,setTimeout(c,g,a,h,o,j)):"timeout"===j&&b.set(h,setTimeout(c,g,b,h,o,j))}})}();'],{type:"application/javascript"}),e=URL.createObjectURL(d),f=function(a){var b=new Map,d=new Map,e=new Worker(a);return e.addEventListener("message",function(a){var c=a.data,e=c.id,f=c.type;if("interval"===f){var g=b.get(e);g&&g()}else if("timeout"===f){var g=d.get(e);g&&(g(),d.delete(e))}}),{clearInterval:function(a){b.delete(a),e.postMessage({action:"clear",id:a,type:"interval"})},clearTimeout:function(a){d.delete(a),e.postMessage({action:"clear",id:a,type:"timeout"})},setInterval:function(a,d){var f=c(b);return b.set(f,function(){a(),e.postMessage({action:"set",delay:d,id:f,now:performance.now(),type:"interval"})}),e.postMessage({action:"set",delay:d,id:f,now:performance.now(),type:"interval"}),f},setTimeout:function(a,b){var f=c(d);return d.set(f,a),e.postMessage({action:"set",delay:b,id:f,now:performance.now(),type:"timeout"}),f}}}(e),g=f.clearInterval,h=f.clearTimeout,i=f.setInterval,j=f.setTimeout;a.clearInterval=g,a.clearTimeout=h,a.setInterval=i,a.setTimeout=j,Object.defineProperty(a,"__esModule",{value:!0})});
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):b(a.workerTimers=a.workerTimers||{})}(this,function(a){"use strict";var b=function(a){return void 0!==a.method},c=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,d=function(a){for(var b=Math.round(Math.random()*c);a.has(b);)b=Math.round(Math.random()*c);return b},e=new Blob(['!function(){"use strict";var a=new Map,b=new Map,c=function(b){var c=a.get(b);if(void 0===c)throw new Error(\'There is no interval scheduled with the given id "\'+b+\'".\');clearTimeout(c),a.delete(b)},d=function(a){var c=b.get(a);if(void 0===c)throw new Error(\'There is no timeout scheduled with the given id "\'+a+\'".\');clearTimeout(c),b.delete(a)},e=function(a,b){var c=void 0;if("performance"in self){var d=performance.now();a-=Math.max(0,d-b),c=d}else c=Date.now();return{delay:a,expected:c+a}},f=function a(b,c,d,e){var f="performance"in self?performance.now():Date.now();f>d?postMessage({id:null,method:"call",params:{timerId:c,timerType:e}}):b.set(c,setTimeout(a,d-f,b,c,d,e))},g=function(b,c,d){var g=void 0,h=e(b,d);b=h.delay,g=h.expected,a.set(c,setTimeout(f,b,a,c,g,"interval"))},h=function(a,c,d){var g=void 0,h=e(a,d);a=h.delay,g=h.expected,b.set(c,setTimeout(f,a,b,c,g,"timeout"))};addEventListener("message",function(a){var b=a.data;try{if("clear"===b.method){var e=b.id,f=b.params,i=f.timerId,j=f.timerType;if("interval"===j)c(i),postMessage({error:null,id:e});else{if("timeout"!==j)throw new Error(\'The given type "\'+j+\'" is not supported\');d(i),postMessage({error:null,id:e})}}else{if("set"!==b.method)throw new Error(\'The given method "\'+b.method+\'" is not supported\');var k=b.params,l=k.delay,m=k.now,n=k.timerId,o=k.timerType;if("interval"===o)g(l,n,m);else{if("timeout"!==o)throw new Error(\'The given type "\'+o+\'" is not supported\');h(l,n,m)}}}catch(a){postMessage({err:{message:a.message}})}})}();'],{type:"application/javascript"}),f=URL.createObjectURL(e),g=function(a){var c=new Map,e=new Map,f=new Map,g=new Worker(a);return g.addEventListener("message",function(a){var d=a.data;if(b(d)){var g=d.params,h=g.timerId,i=g.timerType;if("interval"===i){var j=c.get(h);if("number"==typeof j){var k=f.get(j);if(void 0===k||k.timerId!==h||k.timerType!==i)throw new Error("The timer is in an undefined state.")}else{if(void 0===j)throw new Error("The timer is in an undefined state.");j()}}else if("timeout"===i){var j=e.get(h);if("number"==typeof j){var k=f.get(j);if(void 0===k||k.timerId!==h||k.timerType!==i)throw new Error("The timer is in an undefined state.")}else{if(void 0===j)throw new Error("The timer is in an undefined state.");j(),e.delete(h)}}}else{var l=d.id,k=f.get(l);if(void 0===k)throw new Error("The timer is in an undefined state.");var h=k.timerId,i=k.timerType;f.delete(l),"interval"===i?c.delete(h):e.delete(h)}}),{clearInterval:function(a){var b=d(f);f.set(b,{timerId:a,timerType:"interval"}),c.set(a,b),g.postMessage({id:b,method:"clear",params:{timerId:a,timerType:"interval"}})},clearTimeout:function(a){var b=d(f);f.set(b,{timerId:a,timerType:"timeout"}),e.set(a,b),g.postMessage({id:b,method:"clear",params:{timerId:a,timerType:"timeout"}})},setInterval:function(a,b){var e=d(c);return c.set(e,function(){a(),"function"==typeof c.get(e)&&g.postMessage({id:null,method:"set",params:{delay:b,now:performance.now(),timerId:e,timerType:"interval"}})}),g.postMessage({id:null,method:"set",params:{delay:b,now:performance.now(),timerId:e,timerType:"interval"}}),e},setTimeout:function(a,b){var c=d(e);return e.set(c,a),g.postMessage({id:null,method:"set",params:{delay:b,now:performance.now(),timerId:c,timerType:"timeout"}}),c}}}(f),h=g.clearInterval,i=g.clearTimeout,j=g.setInterval,k=g.setTimeout;a.clearInterval=h,a.clearTimeout=i,a.setInterval=j,a.setTimeout=k,Object.defineProperty(a,"__esModule",{value:!0})});

@@ -10,2 +10,2 @@ import { load } from 'worker-timers-broker';

export var setTimeout = workerTimers.setTimeout;
//# sourceMappingURL=module.js.map
//# sourceMappingURL=/users/chrisguttandin/repositories/worker-timers/node_modules/tsconfig-holy-grail/src/module.js.map
// tslint:disable-next-line:max-line-length
// tslint:disable-next-line:max-line-length
export var worker = "!function(){\"use strict\";var a=new Map,b=new Map,c=function a(b,c,d,e){var f=\"performance\"in self?performance.now():Date.now();f>d?postMessage({id:c,type:e}):b.set(c,setTimeout(a,d-f,b,c,d,e))};addEventListener(\"message\",function(d){var e=d.data,f=e.action,g=e.delay,h=e.id,i=e.now,j=e.type;if(\"clear\"===f){var k=void 0;\"interval\"===j?void 0!==(k=a.get(h))&&(clearTimeout(k),a.delete(h)):\"timeout\"===j&&void 0!==(k=b.get(h))&&(clearTimeout(k),b.delete(h))}else if(\"set\"===f){var l=void 0;if(\"performance\"in self){var m=performance.now(),n=Math.max(0,m-i);g-=n,l=m}else l=Date.now();var o=l+g;\"interval\"===j?a.set(h,setTimeout(c,g,a,h,o,j)):\"timeout\"===j&&b.set(h,setTimeout(c,g,b,h,o,j))}})}();";
//# sourceMappingURL=worker.js.map
export var worker = "!function(){\"use strict\";var a=new Map,b=new Map,c=function(b){var c=a.get(b);if(void 0===c)throw new Error('There is no interval scheduled with the given id \"'+b+'\".');clearTimeout(c),a.delete(b)},d=function(a){var c=b.get(a);if(void 0===c)throw new Error('There is no timeout scheduled with the given id \"'+a+'\".');clearTimeout(c),b.delete(a)},e=function(a,b){var c=void 0;if(\"performance\"in self){var d=performance.now();a-=Math.max(0,d-b),c=d}else c=Date.now();return{delay:a,expected:c+a}},f=function a(b,c,d,e){var f=\"performance\"in self?performance.now():Date.now();f>d?postMessage({id:null,method:\"call\",params:{timerId:c,timerType:e}}):b.set(c,setTimeout(a,d-f,b,c,d,e))},g=function(b,c,d){var g=void 0,h=e(b,d);b=h.delay,g=h.expected,a.set(c,setTimeout(f,b,a,c,g,\"interval\"))},h=function(a,c,d){var g=void 0,h=e(a,d);a=h.delay,g=h.expected,b.set(c,setTimeout(f,a,b,c,g,\"timeout\"))};addEventListener(\"message\",function(a){var b=a.data;try{if(\"clear\"===b.method){var e=b.id,f=b.params,i=f.timerId,j=f.timerType;if(\"interval\"===j)c(i),postMessage({error:null,id:e});else{if(\"timeout\"!==j)throw new Error('The given type \"'+j+'\" is not supported');d(i),postMessage({error:null,id:e})}}else{if(\"set\"!==b.method)throw new Error('The given method \"'+b.method+'\" is not supported');var k=b.params,l=k.delay,m=k.now,n=k.timerId,o=k.timerType;if(\"interval\"===o)g(l,n,m);else{if(\"timeout\"!==o)throw new Error('The given type \"'+o+'\" is not supported');h(l,n,m)}}}catch(a){postMessage({err:{message:a.message}})}})}();";
//# sourceMappingURL=/users/chrisguttandin/repositories/worker-timers/node_modules/tsconfig-holy-grail/src/worker/worker.js.map

@@ -7,6 +7,6 @@ {

"dependencies": {
"worker-timers-broker": "^2.0.0",
"worker-timers-worker": "^2.0.0"
"worker-timers-broker": "^3.0.2",
"worker-timers-worker": "^3.0.1"
},
"description": "A replacement for setInterval() and setTimeout() which works in unfocused windows",
"description": "A replacement for setInterval() and setTimeout() which works in unfocused windows.",
"devDependencies": {

@@ -42,2 +42,3 @@ "babel-preset-es2015": "^6.18.0",

"ts-loader": "^2.0.0",
"tsconfig-holy-grail": "^2.1.0",
"tslint-config-holy-grail": "^7.0.0",

@@ -77,3 +78,3 @@ "typescript": "^2.0.7",

"types": "build/es2015/module.d.ts",
"version": "4.0.1"
"version": "4.0.2"
}
{
"compileOnSave": false,
"compilerOptions": {
"declaration": true,
"lib": [ "dom", "es2015" ],
"module": "es2015",
"moduleResolution": "node",
"outDir": "../build/es2015",
"sourceMap": true,
"target": "es2015",
"typeRoots": [
"../node_modules/@types"
]
}
"extends": "../node_modules/tsconfig-holy-grail/src/tsconfig-browser"
}
// tslint:disable-next-line:max-line-length
export const worker = `!function(){"use strict";var a=new Map,b=new Map,c=function a(b,c,d,e){var f="performance"in self?performance.now():Date.now();f>d?postMessage({id:c,type:e}):b.set(c,setTimeout(a,d-f,b,c,d,e))};addEventListener("message",function(d){var e=d.data,f=e.action,g=e.delay,h=e.id,i=e.now,j=e.type;if("clear"===f){var k=void 0;"interval"===j?void 0!==(k=a.get(h))&&(clearTimeout(k),a.delete(h)):"timeout"===j&&void 0!==(k=b.get(h))&&(clearTimeout(k),b.delete(h))}else if("set"===f){var l=void 0;if("performance"in self){var m=performance.now(),n=Math.max(0,m-i);g-=n,l=m}else l=Date.now();var o=l+g;"interval"===j?a.set(h,setTimeout(c,g,a,h,o,j)):"timeout"===j&&b.set(h,setTimeout(c,g,b,h,o,j))}})}();`;
export const worker = `!function(){"use strict";var a=new Map,b=new Map,c=function(b){var c=a.get(b);if(void 0===c)throw new Error('There is no interval scheduled with the given id "'+b+'".');clearTimeout(c),a.delete(b)},d=function(a){var c=b.get(a);if(void 0===c)throw new Error('There is no timeout scheduled with the given id "'+a+'".');clearTimeout(c),b.delete(a)},e=function(a,b){var c=void 0;if("performance"in self){var d=performance.now();a-=Math.max(0,d-b),c=d}else c=Date.now();return{delay:a,expected:c+a}},f=function a(b,c,d,e){var f="performance"in self?performance.now():Date.now();f>d?postMessage({id:null,method:"call",params:{timerId:c,timerType:e}}):b.set(c,setTimeout(a,d-f,b,c,d,e))},g=function(b,c,d){var g=void 0,h=e(b,d);b=h.delay,g=h.expected,a.set(c,setTimeout(f,b,a,c,g,"interval"))},h=function(a,c,d){var g=void 0,h=e(a,d);a=h.delay,g=h.expected,b.set(c,setTimeout(f,a,b,c,g,"timeout"))};addEventListener("message",function(a){var b=a.data;try{if("clear"===b.method){var e=b.id,f=b.params,i=f.timerId,j=f.timerType;if("interval"===j)c(i),postMessage({error:null,id:e});else{if("timeout"!==j)throw new Error('The given type "'+j+'" is not supported');d(i),postMessage({error:null,id:e})}}else{if("set"!==b.method)throw new Error('The given method "'+b.method+'" is not supported');var k=b.params,l=k.delay,m=k.now,n=k.timerId,o=k.timerType;if("interval"===o)g(l,n,m);else{if("timeout"!==o)throw new Error('The given type "'+o+'" is not supported');h(l,n,m)}}}catch(a){postMessage({err:{message:a.message}})}})}();`;

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