countdown-control
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Countdown control npm npm type definitions

Installation

npm install countdown-control

Usage

HTML

<time id="seconds"></time>
<button id="start">Start</button>
<button id="stop">Stop</button>

JavaScript

import { countdownControl } from 'countdown-control'

const seconds = document.querySelector('#seconds')
const start = document.querySelector('#start')
const stop = document.querySelector('#stop')

const handleChange = (time) => {
	seconds.textContent = time.secondsTotal
}

const countdown = countdownControl(handleChange)

start.addEventListener('click', () => {
	countdownControl.start(60) // Set the countdown to 60 seconds
})

stop.addEventListener('click', () => {
	countdownControl.stop()
})

Demo

For more complex example check code here or live demo here.

Package Sidebar

Install

npm i countdown-control

Weekly Downloads

2

Version

0.3.0

License

ISC

Unpacked Size

21 kB

Total Files

11

Last publish

Collaborators

  • onset