0.3.0 • Published 1 year ago

countdown-control v0.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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.

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago