mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-23 01:57:29 +00:00
Remove event listener
I was a good boy, and made sure to remove my mouse move event listener when the user's mouse came up. Sadly, I didn't then _also_ remove the mouse up event listener. This meant that after clicking a few times, the whole app would stall quite a bit any time your mouse came up.
This commit is contained in:
parent
33e33b2dec
commit
6ee338fc76
1 changed files with 5 additions and 2 deletions
|
|
@ -166,9 +166,12 @@ class WindowManager extends React.Component {
|
|||
this.setState(stateDiff);
|
||||
};
|
||||
|
||||
window.addEventListener("mouseup", () => {
|
||||
const removeListeners = () => {
|
||||
window.removeEventListener("mousemove", handleMouseMove);
|
||||
});
|
||||
window.removeEventListener("mouseup", removeListeners);
|
||||
};
|
||||
|
||||
window.addEventListener("mouseup", removeListeners);
|
||||
window.addEventListener("mousemove", handleMouseMove);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue