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
168
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 3.0.1 to 4.0.0

build/es2015/interfaces/broker-event.d.ts

6

build/es2015/interfaces/index.d.ts

@@ -0,6 +1,8 @@

export * from './broker-event';
export * from './call-notification';
export * from './clear-request';
export * from './clear-response';
export * from './error-notification';
export * from './error-response';
export * from './set-notification';
export * from './worker-timers-broker-event';
export * from './worker-timers-worker-event';
export * from './worker-event';

@@ -36,5 +36,7 @@ import { clearScheduledInterval, clearScheduledTimeout, scheduleInterval, scheduleTimeout } from './helpers/timer';

postMessage({
err: {
error: {
message: err.message
}
},
id: data.id,
result: null
});

@@ -41,0 +43,0 @@ }

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

export * from './broker-message';
export * from './timer-type';
export * from './worker-timers-broker-message';
export * from './worker-timers-worker-message';
export * from './worker-message';

@@ -104,5 +104,7 @@ (function () {

postMessage({
err: {
error: {
message: err.message
}
},
id: data.id,
result: null
});

@@ -109,0 +111,0 @@ }

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

!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}})}})}();
!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({error:{message:a.message},id:b.id,result:null})}})}();

@@ -37,5 +37,7 @@ import { clearScheduledInterval, clearScheduledTimeout, scheduleInterval, scheduleTimeout } from './helpers/timer';

postMessage({
err: {
error: {
message: err.message
}
},
id: data.id,
result: null
});

@@ -42,0 +44,0 @@ }

@@ -62,3 +62,3 @@ {

"types": "build/es2015/module.d.ts",
"version": "3.0.1"
"version": "4.0.0"
}

@@ -0,6 +1,8 @@

export * from './broker-event';
export * from './call-notification';
export * from './clear-request';
export * from './clear-response';
export * from './error-notification';
export * from './error-response';
export * from './set-notification';
export * from './worker-timers-broker-event';
export * from './worker-timers-worker-event';
export * from './worker-event';
import { clearScheduledInterval, clearScheduledTimeout, scheduleInterval, scheduleTimeout } from './helpers/timer';
import { IClearResponse, IWorkerTimersBrokerEvent } from './interfaces';
import { IClearResponse, IBrokerEvent, IErrorNotification, IErrorResponse } from './interfaces';

@@ -7,3 +7,3 @@ export * from './interfaces';

addEventListener('message', ({ data }: IWorkerTimersBrokerEvent) => {
addEventListener('message', ({ data }: IBrokerEvent) => {
try {

@@ -38,8 +38,10 @@ if (data.method === 'clear') {

} catch (err) {
postMessage({
err: {
postMessage(<IErrorNotification | IErrorResponse> {
error: {
message: err.message
}
},
id: data.id,
result: null
});
}
});

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

export * from './broker-message';
export * from './timer-type';
export * from './worker-timers-broker-message';
export * from './worker-timers-worker-message';
export * from './worker-message';

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