Generators: the Gnarly Bits

added by JavaScript Kicks
10/20/2014 12:04:22 PM


With the basics out of the way, let’s go in-depth with a JavaScript sample that covers some of the gotchas, or “gnarly bits”, of working with generators. There are extensive comments throughout, and you can play around with the live version of the code before reading through it


Drew Peterson
10/20/2014 5:59:31 PM
It would be interesting to combine generators with web workers to constantly poll data on a background thread (via websockets or xhr) to avoid the need for something that maintains client state on the server side (such as SignalR) without resorting to the more old-school polling with timeouts.