Skip to content

Commit

Permalink
Ability to set the timeout to 0 (no timeout)
Browse files Browse the repository at this point in the history
  • Loading branch information
wavded committed Dec 10, 2011
1 parent 93278ba commit 4637bd8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
23 changes: 13 additions & 10 deletions humane.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,19 @@
clearTimeout(timeout);
timeout = null;
}
timeout = setTimeout(function(){ // allow notification to stay alive for timeout
if (!eventing) {
on (doc.body,'mousemove',remove);
on (doc.body,'click',remove);
on (doc.body,'keypress',remove);
on (doc.body,'touchstart',remove);
eventing = true;
if(!win.humane.waitForMove) remove();
}
}, win.humane.timeout);

if(win.humane.timeout) {
timeout = setTimeout(function(){ // allow notification to stay alive for timeout
if (!eventing) {
on (doc.body,'mousemove',remove);
on (doc.body,'click',remove);
on (doc.body,'keypress',remove);
on (doc.body,'touchstart',remove);
eventing = true;
if(!win.humane.waitForMove) remove();
}
}, win.humane.timeout);
}

if (humane.clickToClose) { on (humaneEl,'click',remove); on (humaneEl, 'touchstart', remove); }

Expand Down
2 changes: 1 addition & 1 deletion humane.min.js

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

1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ <h3>Options</h3>
<input type='radio' name='timeout' onclick='humane.timeout = 2500' checked> 2500 <small>(2s - default)</small>
<input type='radio' name='timeout' onclick='humane.timeout = 5000'> 5000 <small>(5s)</small>
<input type='radio' name='timeout' onclick='humane.timeout = 500'> 500 <small>(0.5s)</small>
<input type='radio' name='timeout' onclick='humane.timeout = 0'> 0 <small>(no timeout)</small>
</p>
</blockquote>
<pre>humane.waitForMove = (true|false);</pre>
Expand Down

0 comments on commit 4637bd8

Please sign in to comment.