Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.0.2 to 2.1.0

index.d.ts

7

build/react-interval.js

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

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

@@ -156,5 +156,6 @@ /******/ // The module cache

value: function componentDidUpdate(_ref3) {
var enabled = _ref3.enabled;
var enabled = _ref3.enabled,
timeout = _ref3.timeout;
if (this.props.enabled !== enabled) {
if (this.props.enabled !== enabled || this.props.timeout !== timeout) {
if (this.props.enabled) {

@@ -161,0 +162,0 @@ this.start();

@@ -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)})(this,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;this.props.enabled!==b&&(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(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}])});

@@ -71,5 +71,6 @@ 'use strict';

value: function componentDidUpdate(_ref3) {
var enabled = _ref3.enabled;
var enabled = _ref3.enabled,
timeout = _ref3.timeout;
if (this.props.enabled !== enabled) {
if (this.props.enabled !== enabled || this.props.timeout !== timeout) {
if (this.props.enabled) {

@@ -76,0 +77,0 @@ this.start();

{
"name": "react-interval",
"version": "2.0.2",
"version": "2.1.0",
"description": "Safe React wrapper for setInterval",
"main": "lib/index.js",
"types": "index.d.ts",
"config": {

@@ -41,2 +42,3 @@ "component": "ReactInterval"

"peerDependencies": {
"@types/react": "^15.0.0 || ^16.0.0",
"react": "^15.3.0 || ^16.0.0"

@@ -51,2 +53,3 @@ },

"src",
"index.d.ts",
"LICENSE",

@@ -53,0 +56,0 @@ "package.json",

@@ -31,4 +31,4 @@ import React from 'react';

componentDidUpdate({enabled}) {
if (this.props.enabled !== enabled) {
componentDidUpdate({enabled, timeout}) {
if (this.props.enabled !== enabled || this.props.timeout !== timeout) {
if (this.props.enabled) {

@@ -35,0 +35,0 @@ this.start();

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