Make Cursor.detach() safe to call when not attached
Avoids having checks in higher layers.
This commit is contained in:
parent
94c89284fc
commit
9f557f5280
|
@ -64,6 +64,10 @@ export default class Cursor {
|
||||||
}
|
}
|
||||||
|
|
||||||
detach() {
|
detach() {
|
||||||
|
if (!this._target) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (useFallback) {
|
if (useFallback) {
|
||||||
const options = { capture: true, passive: true };
|
const options = { capture: true, passive: true };
|
||||||
this._target.removeEventListener('mouseover', this._eventHandlers.mouseover, options);
|
this._target.removeEventListener('mouseover', this._eventHandlers.mouseover, options);
|
||||||
|
|
Loading…
Reference in New Issue