I wrote some code like the following in tracuer

```
class Foo {
  constructor() {
    spawn(function*() {
      let data = yield this.fetchData(); // error because 'this' is
undefined
    });
  }

  fetchData() {
    // returns promise
  }
}
```

I used the spawn function from here:
https://gist.github.com/jakearchibald/31b89cba627924972ad6

The code doesn't work because 'this' is undefined. I can fix it by using
'let that = this' pattern. But it feels like a step backward now that I've
fallen in love with lambda functions. So I was wondering if it would be
possible to use lexical binding for 'this' inside anonymous generators.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to