1. React
  2. JSConf Korea
  3. 2019
  4. What Tamagotchis can teach you about generators

What Tamagotchis can teach you about generators

Jenn Creighton at JSConf Korea 2019

What do Tamagotchis — everyone’s favorite digital pets from the 90s — and generators — pausible functions for async tasks — have in common? Both are really fun to play with. As a recent side project, I built a web-version of a Tamagotchi. But I struggled with one key element: how to handle a series of animations. What do you do when animations need to know that other animations are complete? What do you do when you’ve queued animations but a user event needs to be handle instead? This talk explores where I went wrong (hint: promises) and what worked (hint: generators). You’ll leave this talk with a solid grasp of how to combine promises, generators, and coroutines for async work — whether it’s for a Tamagotchi or your day-to-day work.