Skip to content

Bound generator yields only undefined #1

@lukas-zech-software

Description

@lukas-zech-software

I'm trying to use your polyfill together with co 4.0.0
But as soon as I apply the bind to the generator it will only yield undefined

co(function* () {
  console.log(this); //Node global object
  const result = yield Promise.resolve(true);
  console.log(result); // true
  return result;
});
require('generator-bind').polyfill();

co(function* () {
  console.log(this); //'CONTEXT'
  const result = yield Promise.resolve(true);
  console.log(result); // undefined
  return result;
}.bind('CONTEXT'));

Same happens when using the genBind function syntax

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions