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

Add support for generators #210

Merged
merged 2 commits into from
Nov 11, 2015
Merged

Conversation

bbqsrc
Copy link
Contributor

@bbqsrc bbqsrc commented Nov 11, 2015

This patch adds support for ES6 generators, without introducing any issues for older versions of node that don't support them.

It allows the use case like the following:

schedule.scheduleJob('someJob', someDate, function*() {
  const record = yield mongoose.model('Foo').findOne(someitem).exec();
  doStuffTo(record);
});

@tejasmanohar
Copy link
Member

👍 overall... This is fair. It won't hurt usage in older versions of node but the tests will fail on older v of node. Maybe we should skip the generator tests on old versions of node (based on process.version) ? @bbqsrc

PS: could be a better way to do it, this is just my first thought

@bbqsrc
Copy link
Contributor Author

bbqsrc commented Nov 11, 2015

@tejasmanohar yeah I just committed that. I forgot that JS does not approve of syntax errors.

This was meant to pass tests in 0.12 and 0.10, I simply derped. Waiting for that green light. 😄

@bbqsrc
Copy link
Contributor Author

bbqsrc commented Nov 11, 2015

It's passing on everything now!

@tejasmanohar
Copy link
Member

I forgot that JS does not approve of syntax errors.

hahahaha, i feel you :P

@tejasmanohar
Copy link
Member

100% fine in my eyes. useful addition for those using the feature in es6/7 + no interference :)

tejasmanohar added a commit that referenced this pull request Nov 11, 2015
Add support for generators
@tejasmanohar tejasmanohar merged commit e94d169 into node-schedule:master Nov 11, 2015
@tejasmanohar
Copy link
Member

💯 whoop

@bbqsrc
Copy link
Contributor Author

bbqsrc commented Nov 11, 2015

Cheers! 👍

@tejasmanohar
Copy link
Member

terminal

congrats! v0.5.0

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

Successfully merging this pull request may close these issues.

None yet

2 participants