Examples of ES6 generators:
- Building an iterator
- Passing data to a generator
- Suspend/resume and control flow
- Delegate generators
- Fake synchronicity ("blocking sleep()")
- Centralized exception handling
sync(function* (resume) {
console.log('foo');
yield setTimeout(resume, 1000);
console.log('baz');
});
console.log('blix');
// console: 'foo', 'blix', 'bax'
- download and install Chrome Canary
- clone the repo
- bundle
- bundle exec ruby ./app.rb
- http://localhost:4567
- click through the examples