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

@weedzcokie/scheduler

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@weedzcokie/scheduler - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

25

main.js

@@ -6,3 +6,3 @@ /**

* @prop {() => unknown | Promise<unknown>} fn
* @prop {NodeJS.Timeout} timeout
* @prop {number} timeout
*/

@@ -33,3 +33,6 @@

const timeDrift = Date.now() - start;
task.timeout = setTimeout(() => runTask(task), task.period - timeDrift);
// Make sure we don't restart a stopped task
if (task.timeout) {
task.timeout = setTimeout(() => runTask(task), task.period - timeDrift);
}
}

@@ -64,2 +67,3 @@

clearTimeout(task.timeout);
task.timeout = 0;
return true;

@@ -69,1 +73,18 @@ }

}
/**
* @param {string} name
* @param {null|number} [offset=null]
* @param {number} [period=0]
*/
export function rescheduleTask(name, period = null, offset = 0) {
const task = tasks.get(name);
if (task) {
if (period !== null) {
task.period = period;
}
clearTimeout(task.timeout);
task.timeout = setTimeout(() => runTask(task), task.period + offset);
return true;
}
return false;
}

2

package.json
{
"name": "@weedzcokie/scheduler",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

@@ -5,0 +5,0 @@ "type": "module",

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