react-idle-timer
Advanced tools
Comparing version
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -7,6 +11,2 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _react = require('react'); | ||
@@ -42,3 +42,3 @@ | ||
function IdleTimer() { | ||
var _Object$getPrototypeO; | ||
var _ref; | ||
@@ -53,3 +53,3 @@ var _temp, _this, _ret; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(IdleTimer)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.state = { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = IdleTimer.__proto__ || Object.getPrototypeOf(IdleTimer)).call.apply(_ref, [this].concat(args))), _this), _this.state = { | ||
idle: false, | ||
@@ -78,6 +78,6 @@ oldDate: +new Date(), | ||
// clear any existing timeout | ||
clearTimeout(_this.tId | ||
clearTimeout(_this.tId); | ||
// if the idle timer is enabled, flip | ||
);if (_this.state.idle) { | ||
if (_this.state.idle) { | ||
_this._toggleIdleState(e); | ||
@@ -92,5 +92,3 @@ } | ||
_this.tId = setTimeout(_this._toggleIdleState.bind(_this), _this.props.timeout // set a new timeout | ||
); | ||
_this.tId = setTimeout(_this._toggleIdleState.bind(_this), _this.props.timeout); // set a new timeout | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -104,2 +102,3 @@ } | ||
if ((typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== 'object') return; | ||
this.props.events.forEach(function (e) { | ||
@@ -121,2 +120,3 @@ return _this2.props.element.addEventListener(e, _this2._handleEvent); | ||
if ((typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== 'object') return; | ||
// Clear timeout to prevent delayed state changes | ||
@@ -213,9 +213,7 @@ clearTimeout(this.tId); | ||
console.log('pausing'); | ||
// clear any existing timeout | ||
clearTimeout(this.tId | ||
clearTimeout(this.tId); | ||
// define how much is left on the timer | ||
);this.setState({ | ||
this.setState({ | ||
remaining: this.getRemainingTime() | ||
@@ -222,0 +220,0 @@ }); |
'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -25,2 +23,4 @@ value: true | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _index = require('../build/index'); | ||
@@ -70,3 +70,3 @@ | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(App).call(this, props)); | ||
var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, props)); | ||
@@ -73,0 +73,0 @@ _this._onActive = function () { |
{ | ||
"name": "react-idle-timer", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Activity detection for React.js", | ||
@@ -15,3 +15,3 @@ "main": "build/index.js", | ||
"start": "NODE_ENV=development node examples/server", | ||
"test": "npm test", | ||
"test": "eslint src", | ||
"release": "standard-version", | ||
@@ -65,7 +65,5 @@ "package": "npm run rebuild && npm version patch && npm publish --tag latest" | ||
"gulp-eslint": "^0.14.0", | ||
"gulp-jest": "^0.4.0", | ||
"gulp-shell": "^0.4.2", | ||
"gulp-uglify": "^1.2.0", | ||
"gulp-util": "^3.0.6", | ||
"jest-cli": "^0.4.13", | ||
"react-transform-catch-errors": "^1.0.2", | ||
@@ -72,0 +70,0 @@ "react-transform-hmr": "^1.0.4", |
28618
0.32%27
-6.9%