Skip to content

Loading…

Add another triger for idle timer events #4

Merged
merged 3 commits into from

2 participants

@ashwinjk

Fixed idle event from being fired when user is clicking on the page

ashwinjk added some commits
@ashwinjk ashwinjk Add support for mousedown event
Idle event was being triggered when user is still clicking on the page
dae14b7
@ashwinjk ashwinjk Revert "Add support for mousedown event"
This reverts commit dae14b7.
cd17466
@ashwinjk ashwinjk Add support for mousedown event
Fixed idle event being triggered when user is clicking on the page
9be56ea
@nzakas
Owner

Can you explain why this is necessary?

@ashwinjk

I had used this module to hide navigation (prev/next) buttons on a carousel module when idle. We observed that when user was clicking next/prev buttons without moving the mouse, idle event was being fired and buttons would hide.

@ashwinjk

Actually the better way to do this is probably allowing users to pass additional events to the idletimer module for triggering idle event

@nzakas nzakas merged commit 041fc33 into nzakas:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 11, 2012
  1. @ashwinjk

    Add support for mousedown event

    ashwinjk committed
    Idle event was being triggered when user is still clicking on the page
  2. @ashwinjk

    Revert "Add support for mousedown event"

    ashwinjk committed
    This reverts commit dae14b7.
  3. @ashwinjk

    Add support for mousedown event

    ashwinjk committed
    Fixed idle event being triggered when user is clicking on the page
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/gallery-idletimer/js/idletimer.js
View
2 src/gallery-idletimer/js/idletimer.js
@@ -128,6 +128,7 @@ Y.IdleTimer = {
//assign appropriate event handlers
Y.on("mousemove", handleUserEvent, doc);
+ Y.on("mousedown", handleUserEvent, doc);
Y.on("keydown", handleUserEvent, doc);
//need to add the old-fashioned way
@@ -158,6 +159,7 @@ Y.IdleTimer = {
//detach the event handlers
Y.detach("mousemove", handleUserEvent, doc);
+ Y.detach("mousedown", handleUserEvent, doc);
Y.detach("keydown", handleUserEvent, doc);
if (doc.removeEventListener) {
Something went wrong with that request. Please try again.