New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only bind event listeners on document when needed. #71

Merged
merged 1 commit into from Feb 13, 2013

Conversation

Projects
None yet
2 participants
@zewt
Copy link
Contributor

zewt commented Feb 12, 2013

Bind mousemove and mouseup only when actually dragging. Previously,
these events were bound at initialization, and left in place even when
no scroller was open. This causes event overhead for any page that loads
the script. Instead, bind these listeners only when actually dragging.

The "if(move)" checks in the event handlers can be removed, but to keep
the patch small and readable I haven't done that.

Only bind event listeners on document when needed.
Bind mousemove and mouseup only when actually dragging.  Previously,
these events were bound at initialization, and left in place even when
no scroller was open.  This causes event overhead for any page that loads
the script.  Instead, bind these listeners only when actually dragging.

The "if(move)" checks in the event handlers can be removed, but to keep
the patch small and readable I haven't done that.

dioslaska added a commit that referenced this pull request Feb 13, 2013

Merge pull request #71 from zewt/reduce-event-listeners
Only bind event listeners on document when needed.

@dioslaska dioslaska merged commit f85fcc5 into acidb:master Feb 13, 2013

@dioslaska

This comment has been minimized.

Copy link
Contributor

dioslaska commented Feb 13, 2013

You are right about the move event, but I still need the end event for other porpuses. But I think the move causes more overhead, because it's fired much more frequently.

I make the necessary code modifications for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment