3 ms·
That wouldn't work, you'd need to at least use bind() so that the `this` keyword within `this.checkStorage` references the right thing, e.g. window.addEven
by allover 9y ago
That wouldn't work, you'd need to at least use bind() so that the `this` keyword within `this.checkStorage` references the right thing, e.g.
window.addEventListener('online', this.checkStorage.bind(this));
- mikewhy 9y agoThe language can do that for you: class Foo { checkStorage = () => { // Do check storage stuff here } } And the language will take care of binding the function. (Really, it's just doing `this.checkStorage = this.checkStorage.bind(this)` in the constructor).
- allover 9y agoThat's not in 'the language' yet :)