ReactFoo Bangalore annual conference

India's largest React conference

Why aren't you using Async Generators yet?

Submitted by Pranay Prakash (@pranaygp) on Saturday, 15 September 2018

videocam_off

Technical level

Intermediate

Section

Full talk

Status

Submitted

Vote on this proposal

Login to vote

Total votes:  +1

Abstract

JavaScript has a new underutilized addition: Async Generators, and they’re a great fit in the functional world and they enable a lot of critical patterns when programming to ensure a clean, scalable codebase. I’ll focus on what Async Generators are, how they work under the hood in browsers, Node.js (and even babel) and filled with examples of use cases in production including how async generators play with the upcoming (probably released by ReactFoo) Async React constructs. Finally, I’ll talk about libraries/tools that can help you develop with them more easily. Anyone programming in JavaScript could benefit from this.

Outline

  • Explain the 4 constructs (the same grid RxJS uses to explain Observables) in programming: Synchronous single value, Synchronous multiple values, Async single values and the “missing” async multiple values.
  • Iterators
  • Observable
  • Async Iterator
  • Iterator spec (making your own iterators) and built in iterators (like Node.js stream)
  • Generators and async generator
  • Examples of usage and patterns (this is the longest bit as I show you how to use it in cases like polling, incremental updates (especially for updating a React tree as data becomes available))

The rest is time allows (I’ve planned for upto 40m with this talk)

  • A comparison with Observables
  • A quick explanation of how this works under the hood (with a potential explanation of the Babel transform)
  • A few examples with Shiksha (a library that implements map, debounce, pairwise etc. inspired by RxJS)

Requirements

Some experience using javascript and asynchronous programming (preferably some experience with Promises and a high level understanding of how a Promise works)

Speaker bio

Pranay worked on GraphQL and Relay at Facebook and on core infra and product at ZEIT. He currently studies at the University of Illinois at Urbana Champaign and did his thesis on “Optimising Javascript with Babel” (including a segment on iterators) which inspired him to dive further into async generators and inspired this talk.

Links

Comments

Login with Twitter or Google to leave a comment