
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@bva/countdown
Advanced tools
This is a JS based component for adding countdown timers using data attributes and minimal JS.
yarn add @bva/countdown
to install, and then import with import Timer from '@bva/countdown';
At the moment there is only one (very optional) parameter (passed in an object):
This is how the component does most of its configuration. There are a couple of data attributes that can be added to timers to change how they operate:
%D:%H:%M:%S
):
The component introduces a custom event as well:
countdownTimerEnded
: this is bound directly to timer elements and is dispatched when the timer's countdown ends.<!-- HTML -->
<div class="my-timer"
data-timer="3600"
data-timer-format="%M:%H"
data-complete-message="Time's up!"
data-lazy-timer
data-pause-timer>
</div>
// JavaScript
import Timer from '@bva/countdown';
document.addEventListener('DOMContentLoaded', () => {
// add event listeners to the timer elements
const timerElements = document.querySelectorAll('[data-timer]');
timerElements.forEach((timerElement) => {
timerElement.addEventListener('countdownTimerEnded', (event) => {
console.log('Timer has ended for:', event.target);
});
});
// now setup all the timers to start their countdowns
Timer.setup({});
});
There are two other methods the component exposes for more manual control over timers:
startTimer
: takes in the timer element as a parameter and will start the timer for that timer element.pauseTimer
: takes in the timer element as a parameter and will stop the timer for that timer element.Here is an example for the two methods:
import Timer from '@bva/countdown';
document.addEventListener('DOMContentLoaded', () => {
// Assuming there is only one timer on the page I care about
const myTimer = document.querySelector('[data-timer]');
Timer.startTimer(myTimer);
const stopButton = document.querySelector('[data-stop-button]');
stopButton.addEventListener('click', () => {
Timer.pauseTimer(myTimer)
});
});
FAQs
Adds a JS component for adding countdown timers
The npm package @bva/countdown receives a total of 1 weekly downloads. As such, @bva/countdown popularity was classified as not popular.
We found that @bva/countdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.