Skip to content Skip to sidebar Skip to footer
Showing posts with the label Generator

How Can I Feature-detect Es6 Generators?

I'm really enjoying ES6 generators. Is there a way I can detect generator support in browsers? … Read more How Can I Feature-detect Es6 Generators?

Why Is Using A Generator Function Slower Than Filling And Iterating An Array In This Example?

A Tale of Two Functions I have one function that fills an array up to a specified value: function g… Read more Why Is Using A Generator Function Slower Than Filling And Iterating An Array In This Example?

How Can I Emulate A Synchronous Call With Generators In Javascript?

Suppose the next piece of code: var co = require('co'); var myObj = { getFieldValue: f… Read more How Can I Emulate A Synchronous Call With Generators In Javascript?

Restarting A Generator In Javascript

In node (0.11.9, with the --harmony flag), how do I restart a generator after it finishes? I tried … Read more Restarting A Generator In Javascript

How Can I Use Async Generators In Javascript?

I have an api thats going to return a cursor for fetching more data. I've mocked it out like th… Read more How Can I Use Async Generators In Javascript?

Receiving `unhandledpromiserejectionwarning` Even Though Rejected Promise Is Handled

I have constructed a function which iterates through a Generator containing both synchronous code a… Read more Receiving `unhandledpromiserejectionwarning` Even Though Rejected Promise Is Handled