Considering the next piece of es2015 code
class MyClass{
constructor () {
this.title = 'Title';
}
update(title) {
this.title = title;
}
}
what is the best way to make sure that inside of update handler I'm referencing my object with this? Currently I have a problem that an external library is calling this update not as an object method call but just as a function call and therefore a reference to this is not correct. Previously I could write something like var that = this; and reference that directly in my handler. But what is the best pattern to accomplish the same idea with es2015 syntax?