Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ES2015 Generator Concepts - NYC Node.js Meetup 20150316

A brief overview of how generators work in ES2015/ES6, with a special focus on how co works.

  • Login to see the comments

  • Be the first to like this

ES2015 Generator Concepts - NYC Node.js Meetup 20150316

  1. 1. ES2015 Generator Concepts Valeri Karpov Platform Tech Lead, Booster Fuels thecodebarbarian.com github.com/vkarpov15 @code_barbarian
  2. 2. What This Talk is About ● What is a generator? ● What can you do with it? ● How does co work?
  3. 3. Terminology ● Generator function ● Generator object (or just generator)
  4. 4. The Yield Keyword ● yield allows re-entry
  5. 5. The Key Idea of Generators ● Yield pauses generator function execution ● Calling next() resumes execution ● Can call next() asynchronously
  6. 6. Why Is This Useful?
  7. 7. Separate Logic From Scheduling
  8. 8. Yielding a Promise
  9. 9. What’s Next? ● Check out The 80/20 Guide to ES2015 Generators ● Rigorous guide to generators as spec-ed with minimal outside dependencies ○ No babel, webpack, angular, react, gulp, etc. etc. ● More detail on how co works ● Plus koa, the web framework based on co ● Plus regenerator, Facebook’s transpiler
  10. 10. Thanks for Listening! Comments, questions, haikus? Read more at: thecodebarbarian.com github.com/vkarpov15 @code_barbarian

×