Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass parameters into onTick function #178

Closed
DmitryEfimenko opened this issue Jun 27, 2015 · 3 comments
Closed

pass parameters into onTick function #178

DmitryEfimenko opened this issue Jun 27, 2015 · 3 comments

Comments

@DmitryEfimenko
Copy link

I know there is this issue, but I feel that a better job could be done with this.
Instead of setting context (which would make this.stop() be unavailable), why not add another property to the CronJob object - params?
Example:

var myParams = { myText: 'this params could be any JSON' };

var job = new CronJob({
  cronTime: '00 30 11 * * 1-5',
  params: myParams,
  onTick: function(p) {
    console.log(p.myText);
  },
  start: false,
  timeZone: 'America/Los_Angeles'
});
@ncb000gt
Copy link
Member

I'd be open to this and would entertain a PR for it. Thanks!

@ncb000gt
Copy link
Member

ncb000gt commented Aug 4, 2018

Closing due to age. Can create a new ticket if it comes up again.

@ncb000gt ncb000gt closed this as completed Aug 4, 2018
@ncb000gt
Copy link
Member

ncb000gt commented Aug 4, 2018

For reference, you should be able to bind parameters to your onTick function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants