Socket
Socket
Sign inDemoInstall

react-interval

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-interval - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

158

build/react-interval.js

@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

root["ReactInterval"] = factory(root["React"]);
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_2__) {
})(window, function(__WEBPACK_EXTERNAL_MODULE__0__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -50,10 +50,30 @@ /******/ // The module cache

/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -74,4 +94,5 @@ /******/ __webpack_require__.n = function(module) {

/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })

@@ -81,5 +102,11 @@ /************************************************************************/

/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
var _require = __webpack_require__(1),
var _require = __webpack_require__(2),
ReactInterval = _require.ReactInterval;

@@ -91,55 +118,83 @@

/***/ }),
/* 1 */
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReactInterval", function() { return ReactInterval; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
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; }; }();
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
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); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var ReactInterval = function (_React$Component) {
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ReactInterval =
/*#__PURE__*/
function (_React$Component) {
_inherits(ReactInterval, _React$Component);
function ReactInterval() {
var _ref;
var _getPrototypeOf2;
var _temp, _this, _ret;
var _this;
_classCallCheck(this, ReactInterval);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ReactInterval.__proto__ || Object.getPrototypeOf(ReactInterval)).call.apply(_ref, [this].concat(args))), _this), _this.callback = function () {
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ReactInterval)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "callback", function () {
if (_this.timer) {
_this.props.callback();
var callback = _this.props.callback;
callback();
_this.start();
}
}, _this.start = function () {
});
_defineProperty(_assertThisInitialized(_this), "start", function () {
_this.stop();
_this.timer = setTimeout(_this.callback, _this.props.timeout);
}, _this.stop = function () {
var timeout = _this.props.timeout;
_this.timer = setTimeout(_this.callback, timeout);
});
_defineProperty(_assertThisInitialized(_this), "stop", function () {
clearTimeout(_this.timer);
_this.timer = null;
}, _this.render = function () {
});
_defineProperty(_assertThisInitialized(_this), "render", function () {
return false;
}, _temp), _possibleConstructorReturn(_this, _ret);
});
return _this;
}
_createClass(ReactInterval, [{
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {
if (this.props.enabled) {
var enabled = this.props.enabled;
if (enabled) {
this.start();

@@ -149,18 +204,24 @@ }

}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(_ref2) {
var timeout = _ref2.timeout,
callback = _ref2.callback,
enabled = _ref2.enabled;
return this.props.timeout !== timeout || this.props.callback !== callback || this.props.enabled !== enabled;
key: "shouldComponentUpdate",
value: function shouldComponentUpdate(_ref) {
var timeout = _ref.timeout,
callback = _ref.callback,
enabled = _ref.enabled;
var _this$props = this.props,
timeout1 = _this$props.timeout,
callback1 = _this$props.callback,
enabled1 = _this$props.enabled;
return timeout1 !== timeout || callback1 !== callback || enabled1 !== enabled;
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(_ref3) {
var enabled = _ref3.enabled,
timeout = _ref3.timeout;
key: "componentDidUpdate",
value: function componentDidUpdate(_ref2) {
var enabled = _ref2.enabled,
timeout = _ref2.timeout;
var _this$props2 = this.props,
timeout1 = _this$props2.timeout,
enabled1 = _this$props2.enabled;
if (this.props.enabled !== enabled || this.props.timeout !== timeout) {
if (this.props.enabled) {
if (enabled1 !== enabled || timeout1 !== timeout) {
if (enabled1) {
this.start();

@@ -173,3 +234,3 @@ } else {

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {

@@ -181,16 +242,11 @@ this.stop();

return ReactInterval;
}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component);
ReactInterval.defaultProps = {
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
_defineProperty(ReactInterval, "defaultProps", {
enabled: false,
timeout: 1000
};
});
/***/ }),
/* 2 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
/***/ })
/******/ ]);
});

@@ -1,1 +0,1 @@

(function(a,b){'object'==typeof exports&&'object'==typeof module?module.exports=b(require('React')):'function'==typeof define&&define.amd?define(['React'],b):'object'==typeof exports?exports.ReactInterval=b(require('React')):a.ReactInterval=b(a.React)})('undefined'==typeof self?this:self,function(a){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=0)}([function(a,b,c){var d=c(1),e=d.ReactInterval;e.ReactInterval=e,a.exports=e},function(a,b,c){'use strict';function d(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function e(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function f(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,'__esModule',{value:!0}),c.d(b,'ReactInterval',function(){return j});var g=c(2);var h=c.n(g);var i=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,'value'in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();var j=function(a){function b(){var a;var c,f,g;d(this,b);for(var h=arguments.length,i=Array(h),j=0;j<h;j++)i[j]=arguments[j];return g=(c=(f=e(this,(a=b.__proto__||Object.getPrototypeOf(b)).call.apply(a,[this].concat(i))),f),f.callback=function(){f.timer&&(f.props.callback(),f.start())},f.start=function(){f.stop(),f.timer=setTimeout(f.callback,f.props.timeout)},f.stop=function(){clearTimeout(f.timer),f.timer=null},f.render=function(){return!1},c),e(f,g)}return f(b,a),i(b,[{key:'componentDidMount',value:function(){this.props.enabled&&this.start()}},{key:'shouldComponentUpdate',value:function(a){var b=a.timeout,c=a.callback,d=a.enabled;return this.props.timeout!==b||this.props.callback!==c||this.props.enabled!==d}},{key:'componentDidUpdate',value:function(a){var b=a.enabled,c=a.timeout;(this.props.enabled!==b||this.props.timeout!==c)&&(this.props.enabled?this.start():this.stop())}},{key:'componentWillUnmount',value:function(){this.stop()}}]),b}(h.a.Component);j.defaultProps={enabled:!1,timeout:1e3}},function(b){b.exports=a}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React")):"function"==typeof define&&define.amd?define(["React"],e):"object"==typeof exports?exports.ReactInterval=e(require("React")):t.ReactInterval=e(t.React)}(window,(function(t){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(e,n){e.exports=t},function(t,e,n){var o=n(2).ReactInterval;o.ReactInterval=o,t.exports=o},function(t,e,n){"use strict";n.r(e),n.d(e,"ReactInterval",(function(){return f}));var o=n(0);function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var f=function(t){function e(){var t,n,o,u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var a=arguments.length,f=new Array(a),p=0;p<a;p++)f[p]=arguments[p];return o=this,u=(t=i(e)).call.apply(t,[this].concat(f)),n=!u||"object"!==r(u)&&"function"!=typeof u?c(o):u,l(c(n),"callback",(function(){n.timer&&((0,n.props.callback)(),n.start())})),l(c(n),"start",(function(){n.stop();var t=n.props.timeout;n.timer=setTimeout(n.callback,t)})),l(c(n),"stop",(function(){clearTimeout(n.timer),n.timer=null})),l(c(n),"render",(function(){return!1})),n}var n,o,f;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(e,t),n=e,(o=[{key:"componentDidMount",value:function(){this.props.enabled&&this.start()}},{key:"shouldComponentUpdate",value:function(t){var e=t.timeout,n=t.callback,o=t.enabled,r=this.props,u=r.timeout,i=r.callback,c=r.enabled;return u!==e||i!==n||c!==o}},{key:"componentDidUpdate",value:function(t){var e=t.enabled,n=t.timeout,o=this.props,r=o.timeout,u=o.enabled;u===e&&r===n||(u?this.start():this.stop())}},{key:"componentWillUnmount",value:function(){this.stop()}}])&&u(n.prototype,o),f&&u(n,f),e}(n.n(o).a.Component);l(f,"defaultProps",{enabled:!1,timeout:1e3})}])}));

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,52 +6,80 @@ Object.defineProperty(exports, "__esModule", {

});
exports.ReactInterval = undefined;
exports.ReactInterval = void 0;
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 _react = _interopRequireDefault(require("react"));
var _react = require('react');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _react2 = _interopRequireDefault(_react);
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
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); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var ReactInterval = exports.ReactInterval = function (_React$Component) {
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ReactInterval =
/*#__PURE__*/
function (_React$Component) {
_inherits(ReactInterval, _React$Component);
function ReactInterval() {
var _ref;
var _getPrototypeOf2;
var _temp, _this, _ret;
var _this;
_classCallCheck(this, ReactInterval);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ReactInterval.__proto__ || Object.getPrototypeOf(ReactInterval)).call.apply(_ref, [this].concat(args))), _this), _this.callback = function () {
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ReactInterval)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "callback", function () {
if (_this.timer) {
_this.props.callback();
var callback = _this.props.callback;
callback();
_this.start();
}
}, _this.start = function () {
});
_defineProperty(_assertThisInitialized(_this), "start", function () {
_this.stop();
_this.timer = setTimeout(_this.callback, _this.props.timeout);
}, _this.stop = function () {
var timeout = _this.props.timeout;
_this.timer = setTimeout(_this.callback, timeout);
});
_defineProperty(_assertThisInitialized(_this), "stop", function () {
clearTimeout(_this.timer);
_this.timer = null;
}, _this.render = function () {
});
_defineProperty(_assertThisInitialized(_this), "render", function () {
return false;
}, _temp), _possibleConstructorReturn(_this, _ret);
});
return _this;
}
_createClass(ReactInterval, [{
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {
if (this.props.enabled) {
var enabled = this.props.enabled;
if (enabled) {
this.start();

@@ -61,18 +89,24 @@ }

}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(_ref2) {
var timeout = _ref2.timeout,
callback = _ref2.callback,
enabled = _ref2.enabled;
return this.props.timeout !== timeout || this.props.callback !== callback || this.props.enabled !== enabled;
key: "shouldComponentUpdate",
value: function shouldComponentUpdate(_ref) {
var timeout = _ref.timeout,
callback = _ref.callback,
enabled = _ref.enabled;
var _this$props = this.props,
timeout1 = _this$props.timeout,
callback1 = _this$props.callback,
enabled1 = _this$props.enabled;
return timeout1 !== timeout || callback1 !== callback || enabled1 !== enabled;
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(_ref3) {
var enabled = _ref3.enabled,
timeout = _ref3.timeout;
key: "componentDidUpdate",
value: function componentDidUpdate(_ref2) {
var enabled = _ref2.enabled,
timeout = _ref2.timeout;
var _this$props2 = this.props,
timeout1 = _this$props2.timeout,
enabled1 = _this$props2.enabled;
if (this.props.enabled !== enabled || this.props.timeout !== timeout) {
if (this.props.enabled) {
if (enabled1 !== enabled || timeout1 !== timeout) {
if (enabled1) {
this.start();

@@ -85,3 +119,3 @@ } else {

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {

@@ -93,7 +127,9 @@ this.stop();

return ReactInterval;
}(_react2.default.Component);
}(_react["default"].Component);
ReactInterval.defaultProps = {
exports.ReactInterval = ReactInterval;
_defineProperty(ReactInterval, "defaultProps", {
enabled: false,
timeout: 1000
};
});
"use strict";
var _require = require("./Component"),
var _require = require('./Component'),
ReactInterval = _require.ReactInterval;

@@ -5,0 +5,0 @@

{
"name": "react-interval",
"version": "2.1.0",
"version": "2.1.1",
"description": "Safe React wrapper for setInterval",

@@ -11,12 +11,17 @@ "main": "lib/index.js",

"scripts": {
"start": "../../scripts/start.js",
"lint": "../../scripts/lint.js",
"test": "../../scripts/test.js",
"e2e": "../../scripts/e2e.js",
"build": "../../scripts/build.js",
"dist": "../../scripts/dist.js",
"lib": "../../scripts/lib.js",
"pub": "../../scripts/pub.js",
"ghPages": "../../scripts/ghPages.js",
"prepublish": "../../scripts/prepublish.js"
"build": "yarn lib && yarn dist",
"start": "NODE_ENV=development webpack-dev-server --config ../../webpack/dev.config.js",
"predist": "rm -rf ./build",
"dist": "NODE_ENV=production webpack-cli --config ../../webpack/dist.config.js && NODE_ENV=production webpack-cli --config ../../webpack/min.config.js",
"preghPages": "yarn pub",
"ghPages": "gh-pages --dist ./pub --repo git@github.com:nkbt/react-interval.git --user nik@butenko.me --branch gh-pages --message 'Publish examples'",
"prelib": "rm -rf ./lib",
"lib": "NODE_ENV=production babel --config-file ../../.babelrc src --out-dir lib",
"lint": "eslint .",
"prepub": "rm -rf ./pub",
"pub": "NODE_ENV=production webpack-cli --config ../../webpack/pub.config.js",
"test": "node test/Component-test.js",
"prepublishOnly": "yarn build",
"postversion": "git push --follow-tags",
"deps": "! depcheck --specials=bin,eslint --ignore-dirs=build,lib,pub | grep --invert-match 'No depcheck issue'"
},

@@ -49,2 +54,33 @@ "repository": "https://github.com/nkbt/react-works/tree/master/packages/interval",

},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"css-loader": "^3.2.0",
"depcheck": "^0.8.3",
"eslint": "^6.4.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0",
"gh-pages": "^2.1.1",
"html-webpack-plugin": "^3.2.0",
"html-webpack-tags-plugin": "^2.0.17",
"mini-css-extract-plugin": "^0.8.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"style-loader": "^1.0.0",
"tape": "^4.11.0",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.1"
},
"files": [

@@ -58,3 +94,4 @@ "build",

"README.md"
]
],
"gitHead": "8175c7c398d3c16f37725428e70b2a80d8de17d0"
}

@@ -18,3 +18,4 @@ import React from 'react';

componentDidMount() {
if (this.props.enabled) {
const {enabled} = this.props;
if (enabled) {
this.start();

@@ -25,6 +26,7 @@ }

shouldComponentUpdate({timeout, callback, enabled}) {
const {timeout: timeout1, callback: callback1, enabled: enabled1} = this.props;
return (
this.props.timeout !== timeout ||
this.props.callback !== callback ||
this.props.enabled !== enabled
timeout1 !== timeout
|| callback1 !== callback
|| enabled1 !== enabled
);

@@ -34,4 +36,5 @@ }

componentDidUpdate({enabled, timeout}) {
if (this.props.enabled !== enabled || this.props.timeout !== timeout) {
if (this.props.enabled) {
const {timeout: timeout1, enabled: enabled1} = this.props;
if (enabled1 !== enabled || timeout1 !== timeout) {
if (enabled1) {
this.start();

@@ -50,3 +53,4 @@ } else {

if (this.timer) {
this.props.callback();
const {callback} = this.props;
callback();
this.start();

@@ -58,3 +62,4 @@ }

this.stop();
this.timer = setTimeout(this.callback, this.props.timeout);
const {timeout} = this.props;
this.timer = setTimeout(this.callback, timeout);
};

@@ -61,0 +66,0 @@

@@ -1,4 +0,4 @@

const {ReactInterval} = require(`./Component`);
const {ReactInterval} = require('./Component');
ReactInterval.ReactInterval = ReactInterval;
module.exports = ReactInterval;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc