-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Error: generatorFunction must be a function
Error: generatorFunction must be a function
You are getting this error when trying to use either Promise.coroutine or Promise.spawn and not passing it a generator function as a parameter. For example:
Promise.spawn(function* () { // Note the *
var data = yield $.get("http://www.example.com");
var moreUrls = data.split("\n");
var contents = [];
for( var i = 0, len = moreUrls.length; i < len; ++i ) {
contents.push(yield $.get(moreUrls[i]));
}
return contents;
});Please refer to the relevant section in the documentation about Generators in order to get usage instructions:
Note: Bluebird used to eagerly check for generators which caused problems with transpilers. Because of this, you might get an error similar to TypeError: Cannot read property 'next' of undefined is you pass a function instead of a generator function to Bluebird.
Promise.spawn and Promise.coroutineare built to work with generators to form C# likeasync/await`
What sorcery is this?!
so just dont wwrite cryptic ancient js that nobody knows because turbo doesnt know eitherhttps://github.com/petkaantonov/bluebird.wiki.git
lol ancient Q JS circa 2012 being called up randoml to make a circular logic loom promise that, surprisingly, does not reject itself when it calls itself!
- Dr Q, the other ancient Q https//github.com/drqedwards/ppm