Take the following example;
class MyClass {
run() {
this.hello = 1;
co(function*() {
this.hello // this is now 'undefined'
})
}
}
new MyClass().run()
In ES5 I would normally assign this
to another variable at the start of the function, such as var cls = this
, but I would have hoped that ES6/ES7 would of solved this problem by now.
Is there a better way to do this?