activity-loop
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -55,2 +55,4 @@ 'use strict'; | ||
this.mousePos = []; | ||
if (typeof activity === 'function') { | ||
@@ -98,3 +100,7 @@ this.on('activity', activity.bind(this)); | ||
key: 'activity', | ||
value: function activity() { | ||
value: function activity(e) { | ||
if (e && e.type === 'mousemove' && e.clientX === this.mousePos[0] && e.clientY === this.mousePos[1]) { | ||
return; | ||
} | ||
if (this.paused) { | ||
@@ -105,2 +111,6 @@ return; | ||
this.restart(); | ||
if (e) { | ||
this.mousePos = [e.clientX, e.clientY]; | ||
} | ||
} | ||
@@ -107,0 +117,0 @@ }, { |
{ | ||
"name": "activity-loop", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Checks whether a user interaction happened on the given element", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -71,3 +71,23 @@ activity-loop | ||
### .pause([paused], [options]) | ||
#### paused | ||
Whether the loop has to be paused | ||
Type: `Boolean` | ||
Default: `true` | ||
#### options | ||
Type: `Object` | ||
Default: `{}` | ||
##### options.activity | ||
You can enforce an immediate `activity` event to be fired after coming back from paused mode | ||
Type: `Boolean` | ||
Default: `false` | ||
The loop instance is an [event emitter](https://nodejs.org/api/events.html) so you can do the following: | ||
@@ -74,0 +94,0 @@ |
10673
134
132