3 ms·
If you plan to remove that event listener later on, you would need to go full verbose. this._callback = this.handleMouseDown.bind(this); elm.addEventListen
by wiredearp 9y ago
If you plan to remove that event listener later on, you would need to go full verbose.
this._callback = this.handleMouseDown.bind(this);
elm.addEventListener('mousedown', this._callback);
elm.removeEventListener('mousedown', this._callback);
this._callback = null;
Compared to:
elm.addEventListener('mousedown', this);
elm.removeEventListener('mousedown', this);
@richthegeek I removed that event listener in my example to illustrate how easy it is, there was otherwise no good reason for it.