Open
Description
Stateful#observe() and Destroyable#own() automatically bind the callback to this
... which was a nice feature until ES6 came along.
Now, code like this has unexpected results:
const MyClass = dcl (null, {
myWidget: ...,
myMethod: function () {
this.myWidget.observe(props => console.log(this));
}
}
```
In the above code it's natural to assume that the `console.log(this)` will print`MyClass`, but it actually refers to `myWidget`,
Metadata
Metadata
Assignees
Labels
No labels