activity-loop
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -100,2 +100,4 @@ 'use strict'; | ||
value: function activity(e) { | ||
var _this = this; | ||
if (e && e.type === 'mousemove' && e.clientX === this.mousePos[0] && e.clientY === this.mousePos[1]) { | ||
@@ -109,4 +111,9 @@ return; | ||
this.emit('activity'); | ||
this.restart(); | ||
// weird but I had to put this operation to the next tick | ||
// otherwise it causes an extra `mousemove` event sometimes. | ||
(0, _utilsSetTimeout2['default'])(function () { | ||
_this.restart(); | ||
}); | ||
if (e) { | ||
@@ -132,6 +139,6 @@ this.mousePos = [e.clientX, e.clientY]; | ||
value: function addListeners() { | ||
var _this = this; | ||
var _this2 = this; | ||
events.forEach(function (e) { | ||
_this.el.addEventListener(e, _this.activity); | ||
_this2.el.addEventListener(e, _this2.activity); | ||
}); | ||
@@ -142,6 +149,6 @@ } | ||
value: function removeListeners() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
events.forEach(function (e) { | ||
_this2.el.removeEventListener(e, _this2.activity); | ||
_this3.el.removeEventListener(e, _this3.activity); | ||
}); | ||
@@ -148,0 +155,0 @@ } |
{ | ||
"name": "activity-loop", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Checks whether a user interaction happened on the given element", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
10900
139