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

timer-countdown

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timer-countdown - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

38

lib/CountdownTimer.js

@@ -80,3 +80,3 @@ "use strict";

const interval = this.props.interval;
const timeRemainingInInterval = this.getTimeRemainingInInterval(interval, differenceInTime);
const timeRemainingInInterval = interval - (differenceInTime % interval)
let timeout = timeRemainingInInterval;

@@ -86,6 +86,10 @@ if (timeRemainingInInterval < (interval / 2.0)) {

}
const timeRemaining = this.getTimeRemaining(differenceInTime);
const timeRemaining = Math.max(this.state.timeRemaining - differenceInTime, 0);
const countdownComplete = (this.state.prevTime && timeRemaining <= 0);
if (is_mounted) {
this.setCurrentState(countdownComplete, timeout, currentTime, timeRemaining);
this.setState({
timeoutId: countdownComplete? null : setInterval(this.startTimer, timeout),
prevTime: currentTime,
timeRemaining: timeRemaining
});
}

@@ -102,30 +106,2 @@ if (countdownComplete && this.props.completeCallback) {

{
key: "getDifferenceInTime",
value: function getDifferenceInTime(currentTime) {
return (this.state.prevTime ? (currentTime - this.state.prevTime) : 0);
}
},
{
key: "getTimeRemainingInInterval",
value: function getTimeRemainingInInterval(interval, differenceInTime) {
return (interval - (differenceInTime % interval));
}
},
{
key: "getTimeRemaining",
value: function getTimeRemaining(differenceInTime) {
return (Math.max(this.state.timeRemaining - differenceInTime, 0));
}
},
{
key: "setCurrentState",
value: function setCurrentState(countdownComplete, timeout, currentTime, timeRemaining) {
this.setState({
timeoutId: countdownComplete? null : setInterval(this.startTimer, timeout),
prevTime: currentTime,
timeRemaining: timeRemaining
});
}
},
{
key: "getFormattedTime",

@@ -132,0 +108,0 @@ value: function getFormattedTime(milliseconds) {

2

package.json
{
"name": "timer-countdown",
"version": "0.0.4",
"version": "0.0.5",
"description": "A well designed ReactJs component for timer-counter",

@@ -5,0 +5,0 @@ "main": "lib/CountdownTimer.js",

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