padolsey / cron.js Goto Github PK
View Code? Open in Web Editor NEWCron for JavaScript. Still in development.
Cron for JavaScript. Still in development.
Should this pattern work?
var CronJob = require('cron').CronJob;
new CronJob('05 * * * * *', function(){
console.log('You will see this message every second');
}, null, true, "America/Los_Angeles");
I want to translate this statement into your cron standard: ( there a lot of standards but don't work for my statement)
The Job runs :
day of week range is set as [1,7] in cron.js, but the specification is [0,6], with 0 representing sunday, and 6 saturday.
Also the README.md is wrong by stating 2-6 is Monday through Friday. In fact, 2-6 is Tuesday through Saturday
Hey James,
Thanks for this library. I know you don't really support it anymore but the node-cron package won't work for me (not running in a node environment). I'd like to use this, but it doesn't seem to have a license attached and the client I'm working for requires that. Any chance you could add one? Cheers.
Patrick
Hello.
I need to delete cronJob object. How can i do it?
In my tests don't work only for December.
I change this line
this.constraints = [[0,59],[0,59],[0,23],[1,31],[0,11],[1,7]];
for thi one
this.constraints = [[0,59],[0,59],[0,23],[1,31],[1,12],[1,7]];
and work now !
It's correct ? or maybe there are more changes to do ?
1ใ
var CronJob = require('cron').CronJob;
for (var i = 0; i < 2; i++) {
new CronJob('* * * * * *', consoleLog(i), null, true, 'America/Los_Angeles');
}
function consoleLog(i) {
console.log(i);
}
when i run this code ,the job run only once and will not continute
2ใ
var CronJob = require('cron').CronJob;
for (var i = 0; i < 2; i++) {
new CronJob('* * * * * *', function () {
console.log(i);
}, null, true, 'America/Los_Angeles');
}
when i run the code above ,i get
2
2
rather than
0
1
here's a patch:
diff --git a/cron.js b/cron.js
index 0c7ef86..160d544 100644
--- a/cron.js
+++ b/cron.js
@@ -77,7 +77,7 @@ var CronJob = (function(){
field.replace(rangePattern, function($0, lower, upper, step) {
step = step || 1;
step = step && parseInt(step) || 1;
// Positive integer higher than constraints[0]
lower = Math.max(low, ~~Math.abs(lower));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.