O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

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.

  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

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