Socket
Socket
Sign inDemoInstall

react-expire

Package Overview
Dependencies
6
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

6

CHANGELOG.md

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

## 1.0.2 / 2019-12-23
- Call onExpire after state changing to prevent worning if component will unmount
## 1.0.1 / 2019-01-28

@@ -7,2 +11,2 @@

- First release.
- First release.

2

dist/Expire.js

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

(function () {var D={};var E,B,F,G,W=false;function X(r){if(null==r)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Y(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de","5"===Object.getOwnPropertyNames(r)[0])return!1;for(var e={},t=0;t<10;t++)e["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(r){return e[r]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(r){n[r]=r}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(o){return!1}}function $(){if(W)return;W=true;E={};B=Object.getOwnPropertySymbols;F=Object.prototype.hasOwnProperty;G=Object.prototype.propertyIsEnumerable;E=Y()?Object.assign:function(r,e){for(var t,n,o=X(r),a=1;a<arguments.length;a++){for(var $ in t=Object(arguments[a]))F.call(t,$)&&(o[$]=t[$]);if(B){n=B(t);for(var s=0;s<n.length;s++)G.call(t,n[s])&&(o[n[s]]=t[n[s]])}}return o}}var ba,j,a,d,H,I,J,M,N,O,P,Q,S,U,V,u,z,q,e,h,w,s,y,g,A,C,o,K=false;function L($,r,a,e,t,n,i,o){if(!$){if($=void 0,void 0===r)$=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var v=[a,e,t,n,i,o],u=0;($=Error(r.replace(/%s/g,function(){return v[u++]}))).name="Invariant Violation"}throw $.framesToPop=1,$}}function f($){for(var r=arguments.length-1,a="https://reactjs.org/docs/error-decoder.html?invariant="+$,e=0;e<r;e++)a+="&args[]="+encodeURIComponent(arguments[e+1]);L(!1,"Minified React error #"+$+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",a)}function c($,r,a){this.props=$,this.context=r,this.refs=q,this.updater=a||z}function r(){}function i($,r,a){this.props=$,this.context=r,this.refs=q,this.updater=a||z}function t($,r,a){var e=void 0,t={},n=null,i=null;if(null!=r)for(e in void 0!==r.ref&&(i=r.ref),void 0!==r.key&&(n=""+r.key),r)w.call(r,e)&&!s.hasOwnProperty(e)&&(t[e]=r[e]);var o=arguments.length-2;if(1===o)t.children=a;else if(1<o){for(var v=Array(o),u=0;u<o;u++)v[u]=arguments[u+2];t.children=v}if($&&$.defaultProps)for(e in o=$.defaultProps)void 0===t[e]&&(t[e]=o[e]);return{$$typeof:d,type:$,key:n,ref:i,props:t,_owner:h.current}}function R($,r){return{$$typeof:d,type:$.type,key:r,ref:$.ref,props:$.props,_owner:$._owner}}function k($){return"object"==typeof $&&null!==$&&$.$$typeof===d}function T($){var r={"=":"=0",":":"=2"};return"$"+(""+$).replace(/[=:]/g,function($){return r[$]})}function v($,r,a,e){if(g.length){var t=g.pop();return t.result=$,t.keyPrefix=r,t.func=a,t.context=e,t.count=0,t}return{result:$,keyPrefix:r,func:a,context:e,count:0}}function x($){$.result=null,$.keyPrefix=null,$.func=null,$.context=null,$.count=0,10>g.length&&g.push($)}function l($,r,a,e){var t=typeof $;"undefined"!==t&&"boolean"!==t||($=null);var n=!1;if(null===$)n=!0;else switch(t){case"string":case"number":n=!0;break;case"object":switch($.$$typeof){case d:case H:n=!0;}}if(n)return a(e,$,""===r?"."+p($,0):r),1;if(n=0,r=""===r?".":r+":",Array.isArray($))for(var i=0;i<$.length;i++){var o=r+p(t=$[i],i);n+=l(t,o,a,e)}else if(null===$||"object"!=typeof $?o=null:o="function"==typeof(o=u&&$[u]||$["@@iterator"])?o:null,"function"==typeof o)for($=o.call($),i=0;!(t=$.next()).done;)n+=l(t=t.value,o=r+p(t,i++),a,e);else"object"===t&&f("31","[object Object]"===(a=""+$)?"object with keys {"+Object.keys($).join(", ")+"}":a,"");return n}function m($,r,a){return null==$?0:l($,"",r,a)}function p($,r){return"object"==typeof $&&null!==$&&null!=$.key?T($.key):r.toString(36)}function Z($,r){$.func.call($.context,r,$.count++)}function _($,r,a){var e=$.result,t=$.keyPrefix;$=$.func.call($.context,r,$.count++),Array.isArray($)?n($,e,a,function($){return $}):null!=$&&(k($)&&($=R($,t+(!$.key||r&&r.key===$.key?"":(""+$.key).replace(y,"$&/")+"/")+a)),e.push($))}function n($,r,a,e,t){var n="";null!=a&&(n=(""+a).replace(y,"$&/")+"/"),m($,_,r=v(r,n,e,t)),x(r)}function aa(){if(K)return;K=true;ba={};j=($(),E);a="function"==typeof Symbol&&Symbol.for;d=a?Symbol.for("react.element"):60103;H=a?Symbol.for("react.portal"):60106;I=a?Symbol.for("react.fragment"):60107;J=a?Symbol.for("react.strict_mode"):60108;M=a?Symbol.for("react.profiler"):60114;N=a?Symbol.for("react.provider"):60109;O=a?Symbol.for("react.context"):60110;P=a?Symbol.for("react.concurrent_mode"):60111;Q=a?Symbol.for("react.forward_ref"):60112;S=a?Symbol.for("react.suspense"):60113;U=a?Symbol.for("react.memo"):60115;V=a?Symbol.for("react.lazy"):60116;u="function"==typeof Symbol&&Symbol.iterator;z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};q={};c.prototype.isReactComponent={},c.prototype.setState=function($,r){"object"!=typeof $&&"function"!=typeof $&&null!=$&&f("85"),this.updater.enqueueSetState(this,$,r,"setState")},c.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")},r.prototype=c.prototype;e=i.prototype=new r;e.constructor=i,j(e,c.prototype),e.isPureReactComponent=!0;h={current:null,currentDispatcher:null};w=Object.prototype.hasOwnProperty;s={key:!0,ref:!0,__self:!0,__source:!0};y=/\/+/g;g=[];A={Children:{map:function($,r,a){if(null==$)return $;var e=[];return n($,e,null,r,a),e},forEach:function($,r,a){if(null==$)return $;m($,Z,r=v(null,null,r,a)),x(r)},count:function($){return m($,function(){return null},null)},toArray:function($){var r=[];return n($,r,null,function($){return $}),r},only:function($){return k($)||f("143"),$}},createRef:function(){return{current:null}},Component:c,PureComponent:i,createContext:function($,r){return void 0===r&&(r=null),($={$$typeof:O,_calculateChangedBits:r,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:N,_context:$},$.Consumer=$},forwardRef:function($){return{$$typeof:Q,render:$}},lazy:function($){return{$$typeof:V,_ctor:$,_status:-1,_result:null}},memo:function($,r){return{$$typeof:U,type:$,compare:void 0===r?null:r}},Fragment:I,StrictMode:J,Suspense:S,createElement:t,cloneElement:function($,r,a){null==$&&f("267",$);var e=void 0,t=j({},$.props),n=$.key,i=$.ref,o=$._owner;if(null!=r){void 0!==r.ref&&(i=r.ref,o=h.current),void 0!==r.key&&(n=""+r.key);var v=void 0;for(e in $.type&&$.type.defaultProps&&(v=$.type.defaultProps),r)w.call(r,e)&&!s.hasOwnProperty(e)&&(t[e]=void 0===r[e]&&void 0!==v?v[e]:r[e])}if(1===(e=arguments.length-2))t.children=a;else if(1<e){v=Array(e);for(var u=0;u<e;u++)v[u]=arguments[u+2];t.children=v}return{$$typeof:d,type:$.type,key:n,ref:i,props:t,_owner:o}},createFactory:function($){var r=t.bind(null,$);return r.type=$,r},isValidElement:k,version:"16.7.0",unstable_ConcurrentMode:P,unstable_Profiler:M,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:h,assign:j}};C={default:A};o=C&&A||C;ba=o.default||o}D=(aa(),ba);var b={},ca=b&&b.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),da=b&&b.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(b,"__esModule",{value:!0});var ea=da(D),fa=function(t){function r(r){var e=t.call(this,r)||this;return e.state={expired:!1},e.expireTimer=null,e}return ca(r,t),r.prototype.componentDidMount=function(){this.props.until>0&&this.startExpiration()},r.prototype.componentDidUpdate=function(t){var r=this.props.until;t.until!==r&&(this.cancelExpiration(),0!==r&&this.startExpiration())},r.prototype.componentWillUnmount=function(){this.cancelExpiration()},r.prototype.render=function(){var t=this.props.children;return"function"==typeof t?t(this.state.expired):t||null},r.prototype.startExpiration=function(){var t=this,r=this.props,e=r.until,o=r.onExpire,n=r.id;this.setState({expired:!1}),this.expireTimer=window.setTimeout(function(){o&&o(n),t.setState({expired:!0})},e)},r.prototype.cancelExpiration=function(){this.expireTimer&&clearTimeout(this.expireTimer)},r}(ea.Component),ga=fa;b.default=ga;if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=b}else if(typeof define==="function"&&define.amd){define(function(){return b})}})();
(function () {var D={};var E,B,F,G,W=false;function X(r){if(null==r)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Y(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de","5"===Object.getOwnPropertyNames(r)[0])return!1;for(var e={},t=0;t<10;t++)e["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(r){return e[r]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(r){n[r]=r}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(o){return!1}}function $(){if(W)return;W=true;E={};B=Object.getOwnPropertySymbols;F=Object.prototype.hasOwnProperty;G=Object.prototype.propertyIsEnumerable;E=Y()?Object.assign:function(r,e){for(var t,n,o=X(r),a=1;a<arguments.length;a++){for(var $ in t=Object(arguments[a]))F.call(t,$)&&(o[$]=t[$]);if(B){n=B(t);for(var s=0;s<n.length;s++)G.call(t,n[s])&&(o[n[s]]=t[n[s]])}}return o}}var ba,j,a,d,H,I,J,M,N,O,P,Q,S,U,V,u,z,q,e,h,w,s,y,g,A,C,o,K=false;function L($,r,a,e,t,n,i,o){if(!$){if($=void 0,void 0===r)$=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var v=[a,e,t,n,i,o],u=0;($=Error(r.replace(/%s/g,function(){return v[u++]}))).name="Invariant Violation"}throw $.framesToPop=1,$}}function f($){for(var r=arguments.length-1,a="https://reactjs.org/docs/error-decoder.html?invariant="+$,e=0;e<r;e++)a+="&args[]="+encodeURIComponent(arguments[e+1]);L(!1,"Minified React error #"+$+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",a)}function c($,r,a){this.props=$,this.context=r,this.refs=q,this.updater=a||z}function r(){}function i($,r,a){this.props=$,this.context=r,this.refs=q,this.updater=a||z}function t($,r,a){var e=void 0,t={},n=null,i=null;if(null!=r)for(e in void 0!==r.ref&&(i=r.ref),void 0!==r.key&&(n=""+r.key),r)w.call(r,e)&&!s.hasOwnProperty(e)&&(t[e]=r[e]);var o=arguments.length-2;if(1===o)t.children=a;else if(1<o){for(var v=Array(o),u=0;u<o;u++)v[u]=arguments[u+2];t.children=v}if($&&$.defaultProps)for(e in o=$.defaultProps)void 0===t[e]&&(t[e]=o[e]);return{$$typeof:d,type:$,key:n,ref:i,props:t,_owner:h.current}}function R($,r){return{$$typeof:d,type:$.type,key:r,ref:$.ref,props:$.props,_owner:$._owner}}function k($){return"object"==typeof $&&null!==$&&$.$$typeof===d}function T($){var r={"=":"=0",":":"=2"};return"$"+(""+$).replace(/[=:]/g,function($){return r[$]})}function v($,r,a,e){if(g.length){var t=g.pop();return t.result=$,t.keyPrefix=r,t.func=a,t.context=e,t.count=0,t}return{result:$,keyPrefix:r,func:a,context:e,count:0}}function x($){$.result=null,$.keyPrefix=null,$.func=null,$.context=null,$.count=0,10>g.length&&g.push($)}function l($,r,a,e){var t=typeof $;"undefined"!==t&&"boolean"!==t||($=null);var n=!1;if(null===$)n=!0;else switch(t){case"string":case"number":n=!0;break;case"object":switch($.$$typeof){case d:case H:n=!0;}}if(n)return a(e,$,""===r?"."+p($,0):r),1;if(n=0,r=""===r?".":r+":",Array.isArray($))for(var i=0;i<$.length;i++){var o=r+p(t=$[i],i);n+=l(t,o,a,e)}else if(null===$||"object"!=typeof $?o=null:o="function"==typeof(o=u&&$[u]||$["@@iterator"])?o:null,"function"==typeof o)for($=o.call($),i=0;!(t=$.next()).done;)n+=l(t=t.value,o=r+p(t,i++),a,e);else"object"===t&&f("31","[object Object]"===(a=""+$)?"object with keys {"+Object.keys($).join(", ")+"}":a,"");return n}function m($,r,a){return null==$?0:l($,"",r,a)}function p($,r){return"object"==typeof $&&null!==$&&null!=$.key?T($.key):r.toString(36)}function Z($,r){$.func.call($.context,r,$.count++)}function _($,r,a){var e=$.result,t=$.keyPrefix;$=$.func.call($.context,r,$.count++),Array.isArray($)?n($,e,a,function($){return $}):null!=$&&(k($)&&($=R($,t+(!$.key||r&&r.key===$.key?"":(""+$.key).replace(y,"$&/")+"/")+a)),e.push($))}function n($,r,a,e,t){var n="";null!=a&&(n=(""+a).replace(y,"$&/")+"/"),m($,_,r=v(r,n,e,t)),x(r)}function aa(){if(K)return;K=true;ba={};j=($(),E);a="function"==typeof Symbol&&Symbol.for;d=a?Symbol.for("react.element"):60103;H=a?Symbol.for("react.portal"):60106;I=a?Symbol.for("react.fragment"):60107;J=a?Symbol.for("react.strict_mode"):60108;M=a?Symbol.for("react.profiler"):60114;N=a?Symbol.for("react.provider"):60109;O=a?Symbol.for("react.context"):60110;P=a?Symbol.for("react.concurrent_mode"):60111;Q=a?Symbol.for("react.forward_ref"):60112;S=a?Symbol.for("react.suspense"):60113;U=a?Symbol.for("react.memo"):60115;V=a?Symbol.for("react.lazy"):60116;u="function"==typeof Symbol&&Symbol.iterator;z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};q={};c.prototype.isReactComponent={},c.prototype.setState=function($,r){"object"!=typeof $&&"function"!=typeof $&&null!=$&&f("85"),this.updater.enqueueSetState(this,$,r,"setState")},c.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")},r.prototype=c.prototype;e=i.prototype=new r;e.constructor=i,j(e,c.prototype),e.isPureReactComponent=!0;h={current:null,currentDispatcher:null};w=Object.prototype.hasOwnProperty;s={key:!0,ref:!0,__self:!0,__source:!0};y=/\/+/g;g=[];A={Children:{map:function($,r,a){if(null==$)return $;var e=[];return n($,e,null,r,a),e},forEach:function($,r,a){if(null==$)return $;m($,Z,r=v(null,null,r,a)),x(r)},count:function($){return m($,function(){return null},null)},toArray:function($){var r=[];return n($,r,null,function($){return $}),r},only:function($){return k($)||f("143"),$}},createRef:function(){return{current:null}},Component:c,PureComponent:i,createContext:function($,r){return void 0===r&&(r=null),($={$$typeof:O,_calculateChangedBits:r,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:N,_context:$},$.Consumer=$},forwardRef:function($){return{$$typeof:Q,render:$}},lazy:function($){return{$$typeof:V,_ctor:$,_status:-1,_result:null}},memo:function($,r){return{$$typeof:U,type:$,compare:void 0===r?null:r}},Fragment:I,StrictMode:J,Suspense:S,createElement:t,cloneElement:function($,r,a){null==$&&f("267",$);var e=void 0,t=j({},$.props),n=$.key,i=$.ref,o=$._owner;if(null!=r){void 0!==r.ref&&(i=r.ref,o=h.current),void 0!==r.key&&(n=""+r.key);var v=void 0;for(e in $.type&&$.type.defaultProps&&(v=$.type.defaultProps),r)w.call(r,e)&&!s.hasOwnProperty(e)&&(t[e]=void 0===r[e]&&void 0!==v?v[e]:r[e])}if(1===(e=arguments.length-2))t.children=a;else if(1<e){v=Array(e);for(var u=0;u<e;u++)v[u]=arguments[u+2];t.children=v}return{$$typeof:d,type:$.type,key:n,ref:i,props:t,_owner:o}},createFactory:function($){var r=t.bind(null,$);return r.type=$,r},isValidElement:k,version:"16.7.0",unstable_ConcurrentMode:P,unstable_Profiler:M,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:h,assign:j}};C={default:A};o=C&&A||C;ba=o.default||o}D=(aa(),ba);var b={},ca=b&&b.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),da=b&&b.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(b,"__esModule",{value:!0});var ea=da(D),fa=function(t){function r(r){var e=t.call(this,r)||this;return e.state={expired:!1},e.expireTimer=null,e}return ca(r,t),r.prototype.componentDidMount=function(){this.props.until>0&&this.startExpiration()},r.prototype.componentDidUpdate=function(t){var r=this.props.until;t.until!==r&&(this.cancelExpiration(),0!==r&&this.startExpiration())},r.prototype.componentWillUnmount=function(){this.cancelExpiration()},r.prototype.render=function(){var t=this.props.children;return"function"==typeof t?t(this.state.expired):t||null},r.prototype.startExpiration=function(){var t=this,r=this.props,e=r.until,o=r.onExpire,n=r.id;this.setState({expired:!1}),this.expireTimer=window.setTimeout(function(){t.setState({expired:!0}),o&&o(n)},e)},r.prototype.cancelExpiration=function(){this.expireTimer&&clearTimeout(this.expireTimer)},r}(ea.Component),ga=fa;b.default=ga;if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=b}else if(typeof define==="function"&&define.amd){define(function(){return b})}})();
{
"name": "react-expire",
"description": "React component for managing time expiration",
"version": "1.0.1",
"version": "1.0.2",
"main": "dist/Expire.js",

@@ -6,0 +6,0 @@ "typings": "dist/Expire.d.ts",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc