New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-countdown-hook

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-countdown-hook - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

dist/index.js

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

var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;module.exports=function(e,r){void 0===e&&(e=6e4),void 0===r&&(r=1e3);var n=t.useState(0),u=n[0],a=n[1],c=t.useRef({}),i=function e(t){c.current.started||(c.current.started=t,c.current.lastInterval=t);var n=Math.min(r,c.current.timeLeft||Infinity);t-c.current.lastInterval>=n&&(c.current.lastInterval+=n,a(function(e){return c.current.timeLeft=e-n,c.current.timeLeft})),t-c.current.started<c.current.timeToCount&&(c.current.requestId=window.requestAnimationFrame(e))},o=t.useCallback(function(t){window.cancelAnimationFrame(c.current.requestId);var r=void 0!==t?t:e;c.current.started=null,c.current.lastInterval=null,c.current.timeToCount=r,c.current.requestId=window.requestAnimationFrame(i),a(r)},[]),s=t.useCallback(function(){window.cancelAnimationFrame(c.current.requestId),c.current.started=null,c.current.lastInterval=null,c.current.timeToCount=c.current.timeLeft},[]),l=t.useCallback(function(){!c.current.started&&c.current.timeLeft>0&&(window.cancelAnimationFrame(c.current.requestId),c.current.requestId=window.requestAnimationFrame(i))},[]),m=t.useCallback(function(){c.current.timeLeft&&(window.cancelAnimationFrame(c.current.requestId),c.current={},a(0))},[]),d=t.useMemo(function(){return{start:o,pause:s,resume:l,reset:m}},[]);return t.useEffect(function(){return m},[]),[u,d]};
var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;module.exports=function(e,r){void 0===e&&(e=6e4),void 0===r&&(r=1e3);var n=t.useState(0),u=n[0],a=n[1],c=t.useRef({}),i=function e(t){c.current.started||(c.current.started=t,c.current.lastInterval=t);var n=Math.min(r,c.current.timeLeft||Infinity);t-c.current.lastInterval>=n&&(c.current.lastInterval+=n,a(function(e){return c.current.timeLeft=e-n,c.current.timeLeft})),t-c.current.started<c.current.timeToCount?c.current.requestId=window.requestAnimationFrame(e):(c.current={},a(0))},o=t.useCallback(function(t){window.cancelAnimationFrame(c.current.requestId);var r=void 0!==t?t:e;c.current.started=null,c.current.lastInterval=null,c.current.timeToCount=r,c.current.requestId=window.requestAnimationFrame(i),a(r)},[]),s=t.useCallback(function(){window.cancelAnimationFrame(c.current.requestId),c.current.started=null,c.current.lastInterval=null,c.current.timeToCount=c.current.timeLeft},[]),l=t.useCallback(function(){!c.current.started&&c.current.timeLeft>0&&(window.cancelAnimationFrame(c.current.requestId),c.current.requestId=window.requestAnimationFrame(i))},[]),m=t.useCallback(function(){c.current.timeLeft&&(window.cancelAnimationFrame(c.current.requestId),c.current={},a(0))},[]),d=t.useMemo(function(){return{start:o,pause:s,resume:l,reset:m}},[]);return t.useEffect(function(){return m},[]),[u,d]};
//# sourceMappingURL=index.js.map

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

import e from"react";export default(t=6e4,r=1e3)=>{const[n,u]=e.useState(0),a=e.useRef({}),c=e=>{a.current.started||(a.current.started=e,a.current.lastInterval=e);const t=Math.min(r,a.current.timeLeft||Infinity);e-a.current.lastInterval>=t&&(a.current.lastInterval+=t,u(e=>(a.current.timeLeft=e-t,a.current.timeLeft))),e-a.current.started<a.current.timeToCount&&(a.current.requestId=window.requestAnimationFrame(c))},s=e.useCallback(e=>{window.cancelAnimationFrame(a.current.requestId);const r=void 0!==e?e:t;a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=r,a.current.requestId=window.requestAnimationFrame(c),u(r)},[]),i=e.useCallback(()=>{window.cancelAnimationFrame(a.current.requestId),a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=a.current.timeLeft},[]),l=e.useCallback(()=>{!a.current.started&&a.current.timeLeft>0&&(window.cancelAnimationFrame(a.current.requestId),a.current.requestId=window.requestAnimationFrame(c))},[]),m=e.useCallback(()=>{a.current.timeLeft&&(window.cancelAnimationFrame(a.current.requestId),a.current={},u(0))},[]),o=e.useMemo(()=>({start:s,pause:i,resume:l,reset:m}),[]);return e.useEffect(()=>m,[]),[n,o]};
import e from"react";export default(t=6e4,r=1e3)=>{const[n,u]=e.useState(0),a=e.useRef({}),c=e=>{a.current.started||(a.current.started=e,a.current.lastInterval=e);const t=Math.min(r,a.current.timeLeft||Infinity);e-a.current.lastInterval>=t&&(a.current.lastInterval+=t,u(e=>(a.current.timeLeft=e-t,a.current.timeLeft))),e-a.current.started<a.current.timeToCount?a.current.requestId=window.requestAnimationFrame(c):(a.current={},u(0))},s=e.useCallback(e=>{window.cancelAnimationFrame(a.current.requestId);const r=void 0!==e?e:t;a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=r,a.current.requestId=window.requestAnimationFrame(c),u(r)},[]),i=e.useCallback(()=>{window.cancelAnimationFrame(a.current.requestId),a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=a.current.timeLeft},[]),l=e.useCallback(()=>{!a.current.started&&a.current.timeLeft>0&&(window.cancelAnimationFrame(a.current.requestId),a.current.requestId=window.requestAnimationFrame(c))},[]),m=e.useCallback(()=>{a.current.timeLeft&&(window.cancelAnimationFrame(a.current.requestId),a.current={},u(0))},[]),o=e.useMemo(()=>({start:s,pause:i,resume:l,reset:m}),[]);return e.useEffect(()=>m,[]),[n,o]};
//# sourceMappingURL=index.modern.js.map

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

import e from"react";export default function(t,r){void 0===t&&(t=6e4),void 0===r&&(r=1e3);var n=e.useState(0),u=n[0],a=n[1],c=e.useRef({}),i=function e(t){c.current.started||(c.current.started=t,c.current.lastInterval=t);var n=Math.min(r,c.current.timeLeft||Infinity);t-c.current.lastInterval>=n&&(c.current.lastInterval+=n,a(function(e){return c.current.timeLeft=e-n,c.current.timeLeft})),t-c.current.started<c.current.timeToCount&&(c.current.requestId=window.requestAnimationFrame(e))},o=e.useCallback(function(e){window.cancelAnimationFrame(c.current.requestId);var r=void 0!==e?e:t;c.current.started=null,c.current.lastInterval=null,c.current.timeToCount=r,c.current.requestId=window.requestAnimationFrame(i),a(r)},[]),s=e.useCallback(function(){window.cancelAnimationFrame(c.current.requestId),c.current.started=null,c.current.lastInterval=null,c.current.timeToCount=c.current.timeLeft},[]),l=e.useCallback(function(){!c.current.started&&c.current.timeLeft>0&&(window.cancelAnimationFrame(c.current.requestId),c.current.requestId=window.requestAnimationFrame(i))},[]),m=e.useCallback(function(){c.current.timeLeft&&(window.cancelAnimationFrame(c.current.requestId),c.current={},a(0))},[]),d=e.useMemo(function(){return{start:o,pause:s,resume:l,reset:m}},[]);return e.useEffect(function(){return m},[]),[u,d]}
import e from"react";export default function(t,r){void 0===t&&(t=6e4),void 0===r&&(r=1e3);var n=e.useState(0),u=n[0],c=n[1],a=e.useRef({}),i=function e(t){a.current.started||(a.current.started=t,a.current.lastInterval=t);var n=Math.min(r,a.current.timeLeft||Infinity);t-a.current.lastInterval>=n&&(a.current.lastInterval+=n,c(function(e){return a.current.timeLeft=e-n,a.current.timeLeft})),t-a.current.started<a.current.timeToCount?a.current.requestId=window.requestAnimationFrame(e):(a.current={},c(0))},o=e.useCallback(function(e){window.cancelAnimationFrame(a.current.requestId);var r=void 0!==e?e:t;a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=r,a.current.requestId=window.requestAnimationFrame(i),c(r)},[]),s=e.useCallback(function(){window.cancelAnimationFrame(a.current.requestId),a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=a.current.timeLeft},[]),l=e.useCallback(function(){!a.current.started&&a.current.timeLeft>0&&(window.cancelAnimationFrame(a.current.requestId),a.current.requestId=window.requestAnimationFrame(i))},[]),m=e.useCallback(function(){a.current.timeLeft&&(window.cancelAnimationFrame(a.current.requestId),a.current={},c(0))},[]),d=e.useMemo(function(){return{start:o,pause:s,resume:l,reset:m}},[]);return e.useEffect(function(){return m},[]),[u,d]}
//# sourceMappingURL=index.module.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).reactCountdownHook=t(e.react)}(this,function(e){return e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,function(t,r){void 0===t&&(t=6e4),void 0===r&&(r=1e3);var n=e.useState(0),u=n[0],c=n[1],a=e.useRef({}),i=function e(t){a.current.started||(a.current.started=t,a.current.lastInterval=t);var n=Math.min(r,a.current.timeLeft||Infinity);t-a.current.lastInterval>=n&&(a.current.lastInterval+=n,c(function(e){return a.current.timeLeft=e-n,a.current.timeLeft})),t-a.current.started<a.current.timeToCount&&(a.current.requestId=window.requestAnimationFrame(e))},o=e.useCallback(function(e){window.cancelAnimationFrame(a.current.requestId);var r=void 0!==e?e:t;a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=r,a.current.requestId=window.requestAnimationFrame(i),c(r)},[]),s=e.useCallback(function(){window.cancelAnimationFrame(a.current.requestId),a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=a.current.timeLeft},[]),l=e.useCallback(function(){!a.current.started&&a.current.timeLeft>0&&(window.cancelAnimationFrame(a.current.requestId),a.current.requestId=window.requestAnimationFrame(i))},[]),d=e.useCallback(function(){a.current.timeLeft&&(window.cancelAnimationFrame(a.current.requestId),a.current={},c(0))},[]),f=e.useMemo(function(){return{start:o,pause:s,resume:l,reset:d}},[]);return e.useEffect(function(){return d},[]),[u,f]}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).reactCountdownHook=t(e.react)}(this,function(e){return e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,function(t,r){void 0===t&&(t=6e4),void 0===r&&(r=1e3);var n=e.useState(0),u=n[0],c=n[1],a=e.useRef({}),i=function e(t){a.current.started||(a.current.started=t,a.current.lastInterval=t);var n=Math.min(r,a.current.timeLeft||Infinity);t-a.current.lastInterval>=n&&(a.current.lastInterval+=n,c(function(e){return a.current.timeLeft=e-n,a.current.timeLeft})),t-a.current.started<a.current.timeToCount?a.current.requestId=window.requestAnimationFrame(e):(a.current={},c(0))},o=e.useCallback(function(e){window.cancelAnimationFrame(a.current.requestId);var r=void 0!==e?e:t;a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=r,a.current.requestId=window.requestAnimationFrame(i),c(r)},[]),s=e.useCallback(function(){window.cancelAnimationFrame(a.current.requestId),a.current.started=null,a.current.lastInterval=null,a.current.timeToCount=a.current.timeLeft},[]),l=e.useCallback(function(){!a.current.started&&a.current.timeLeft>0&&(window.cancelAnimationFrame(a.current.requestId),a.current.requestId=window.requestAnimationFrame(i))},[]),d=e.useCallback(function(){a.current.timeLeft&&(window.cancelAnimationFrame(a.current.requestId),a.current={},c(0))},[]),f=e.useMemo(function(){return{start:o,pause:s,resume:l,reset:d}},[]);return e.useEffect(function(){return d},[]),[u,f]}});
//# sourceMappingURL=index.umd.js.map
{
"name": "react-countdown-hook",
"version": "1.0.2",
"version": "1.0.3",
"description": "Dead simple yet powerful countdown hook for React.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -24,2 +24,5 @@ import React from 'react';

timer.current.requestId = window.requestAnimationFrame(run);
} else {
timer.current = {};
setTimeLeft(0);
}

@@ -26,0 +29,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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