Skip to content

Commit

Permalink
Merge pull request #22 from ashupp/master
Browse files Browse the repository at this point in the history
Corrected logic in resetTimeout
  • Loading branch information
henriqueboaventura authored Feb 6, 2017
2 parents 05ca0e8 + a175fca commit 21cd408
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ idle({

##Changelog

###1.2.7
--------
* Corrected the logic in resetTimeout. Setting the idle = false before calling the onActive handler prevents looping when calling idle:stop in the onActive handler. ([@ashupp](https://github.com/ashupp))

###1.2.6
--------
* Added a non-Jquery version ([@hugohil](https://github.com/hugohil))
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery.idle",
"main": "jquery.idle.js",
"version": "1.2.6",
"version": "1.2.7",
"homepage": "https://github.com/kidh0/jquery.idle",
"authors": [
"Henrique Boaventura <hboaventura@gmail.com>"
Expand Down
4 changes: 2 additions & 2 deletions jquery.idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* About: Author
* Henrique Boaventura (hboaventura@gmail.com).
* About: Version
* 1.2.6
* 1.2.7
* About: License
* Copyright (C) 2013, Henrique Boaventura (hboaventura@gmail.com).
* MIT License:
Expand Down Expand Up @@ -58,8 +58,8 @@

resetTimeout = function (id, settings) {
if (idle) {
settings.onActive.call();
idle = false;
settings.onActive.call();
}
clearTimeout(id);
if(settings.keepTracking) {
Expand Down
4 changes: 2 additions & 2 deletions jquery.idle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery.idle",
"version": "1.2.6",
"version": "1.2.7",
"description": "A dead simple jQuery plugin that executes a callback function if the user is idle.",
"main": "jquery.idle.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions vanilla.idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @title: Vanilla Idle.
* @description: A simple VanillaJS port of this jQuery plugin.
* @author @hugohil
* @version 1.2.6
* @version 1.2.7
* @license https://opensource.org/licenses/MIT
*/

Expand Down Expand Up @@ -38,8 +38,8 @@

var resetTimeout = function resetTimeout (id, settings){
if(idle){
settings.onActive.call();
idle = false;
settings.onActive.call();
}
clearTimeout(id);
if(settings.keepTracking){
Expand Down
2 changes: 1 addition & 1 deletion vanilla.idle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 21cd408

Please sign in to comment.