Skip to content

Commit

Permalink
Fix function not removed on end (#9)
Browse files Browse the repository at this point in the history
* Fix function not removed on end
  • Loading branch information
roderickhsiao committed Mar 12, 2019
1 parent eec3de0 commit 937ede7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "idle-tracker",
"version": "0.0.5",
"version": "0.0.6",
"description": "Pure Javascript library to track browser inactivity",
"author": "Roderick Hsiao <roderickhsiao@gmail.com>",
"repository": {
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ class IdleTracker {

start = ({ onIdleCallback } = {}) => {
this.callback = onIdleCallback || this.callback;
this.handleEvent = this.handleEvent.bind(this);

this.listeners = this.events.map(eventName => {
document.addEventListener(eventName, this.handleEvent.bind(this), false);
document.addEventListener(eventName, this.handleEvent, false);
return eventName;
});

Expand Down

0 comments on commit 937ede7

Please sign in to comment.