Skip to content
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

BUG: handled idle incorrect #28

Open
sea-kg opened this issue Dec 23, 2015 · 13 comments
Open

BUG: handled idle incorrect #28

sea-kg opened this issue Dec 23, 2015 · 13 comments

Comments

@sea-kg
Copy link

sea-kg commented Dec 23, 2015

If switch between tabs, any time I get "idle"
if the time has not come: I expected get "focus" not "idle"

Example of code:

ifvisible.setIdleDuration(600); // 10 min == 600 sec
ifvisible.idle(function(){
    console.log("ifvisible.idle handled");
});
@roundrobin
Copy link

Same here! I think that is pretty confusing if designed like this.

@prabhu
Copy link

prabhu commented Feb 5, 2016

Yes the code is directly firing the idle event when blurred. Below is a workaround that will give you some mileage.

var idleInfo = ifvisible.getIdleInfo();
if (!idleInfo.isIdle) {
   return;
}

A good fix could be to have a set method that enable/disables this behaviour.

@roundrobin
Copy link

thanks for the answer, handled this case myself in the meantime.

I agree, exposing this as a configureable setting would be really making this library complete.

@maybecryptic
Copy link

maybecryptic commented Jul 9, 2016

Just ran into this issue, can't believe it hasn't been fixed since this issue was started over half a year ago.

@prabhu response works, but if you tab out, you will never be counted as idle. This will only work if you stay tabbed in.

@serkanyersen are you aware of this?

EDIT: I managed to fix it. Under blur: function(callback), change customEvent.fire(this, "idle"); to trackIdleStatus(); 👍

@serkanyersen
Copy link
Owner

Just fixed this issue in master. there was a minor race condition, and one of the timeouts were not clearing properly. it's all resolved now.

@maybecryptic
Copy link

@serkanyersen did you test it? That didn't fix it for me.

@serkanyersen
Copy link
Owner

if you are testing this on demo site, that's not updated yet.

@maybecryptic
Copy link

I am not. I downloaded both the js and min js to test, and both don't work.

@serkanyersen
Copy link
Owner

Wait I think I closed the wrong issue :/ I'll work on this one as well. sorry about that

@serkanyersen serkanyersen reopened this Jul 9, 2016
@prabhu
Copy link

prabhu commented Jul 11, 2016

Please take time with your fix. Ideally we would like to review the fix if possible since I feel this library is quite flaky as it is.

@serkanyersen
Copy link
Owner

I'm actually porting the library into Typescript at the moment #33 . Which is going to be much more robust. I'll also have plenty of unit tests on that port.

Most of the bugs and low maintenance of this library happens because of coffee script. That was a bad choice :/

@serkanyersen
Copy link
Owner

I can't seem to recreate this issue. Can someone give me step by step?

Also please checkout my comment on #38 any help is appreciated. Maybe V2 has solved this issue, I'm not sure.

Thanks

@akira32chen
Copy link

akira32chen commented Mar 6, 2018

ifvisible.js prevent blur to trigger idle event as below
http://blog.xuite.net/akira32/home/569372678

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants