
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

timr offers a scheduling interface for a cron like job execution.
npm install timr
var moment = require('moment');
var timr = require('timr');
var scheduler = timr();
////every 15 seconds
scheduler().every(15).seconds().run(function() {
console.log( 'every 15 seconds' );
});
//start 30 seconds from now, execute every 10 seconds, end in 5 minutes from now
var from = moment().add('seconds', 30);
var to = moment().add('minutes', 5);
scheduler()
.from(from)
.to(to)
.every(10).seconds()
.run(function() {
console.log( 'now+30s every 10s until now+5m' );
});
a scheduler holds a collection of tasks. every task is created via the task construction function.
var timr = require('timr');
var taskConstructor = timr();
the scheduler object is exposed at the task constructor:
var timr = require('timr');
var taskConstructor = timr();
console.log( taskConstructor.scheduler );
when a attached task is executed, the parent scheduler also emits a execution event
var timr = require('timr');
var taskConstructor = timr();
//...create some tasks...
taskConstructor.scheduler.on('execute', function(name, task) {
//universal handler for all tasks attached to the scheduler
});
specify how often and when a task should be performed.
via the methods .from(timestamp) and .to(timestamp) the period of time can be specified in which the task should be performed.
these methods can be used in every combination or can be omitted completely. (which would case a task to run instantly and indefinitely.
the quantifier .every(n) in combination with a interval modifier like .hour(), .minute() etc defines how often a task gets executed.
the n parameter can be omitted, it defaults to 1. (task.every().minute() means that a task is executed once a minute)
for example the expression task.every(2).minutes() executes the task every 2 minutes.
there are five interval modifiers:
.second()
.minute()
.hour()
.day()
.month()
for every modifier also the plural form is valid. (e.g. .minutes() instead of .minute())
tasks geht automatically attached to the parent scheduler object
var myTask = taskConstructor();
there are multiple ways of invoking a task.
creates the task, configures it to run every minute and runs the callback assigned in the run handler
taskConstructor().every().minute().run(function() { ... });
creates the task, configures it to run every minute and runs each callback.
taskConstructor()
.every().minute()
.run(function() { ... })
.run(function() { ... })
.run(function() { ... });
creates the task, configures it to run every minute and runs the callback assigned in the run handler.
run has to be called.
var myTask = taskConstructor().every().minute();
myTask.on('execute', function() {
// ...
});
myTask.on('execute', function() {
// ...
});
myTask.run();
creates two anonymous tasks, configures to run the first every minute and the second to run every second hour.
than the events emitted on the scheduler are used to consume the task events.
run has to be called.
taskConstructor().every().minute().run();
taskConstructor().every(2).hours().run();
taskConstructor.scheduler.on('execute', function(name, task) {
// gets invoked every minute and every second hour
});
npm test
FAQs
cron like job scheduling library
We found that timr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.