1.0.3 • Published 2 years ago

duck-timer v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

DuckTimer

Node.js CI npm version Downloads

A helpful timer class for both of browsers and node.js.

Installation

npm install duck-timer

Usage

Stopwatch

import DuckTimer from 'duck-timer';
const timer = new DuckTimer({ interval: 100 }); // interval time: 100ms = 0.1sec.

// start.
timer.onInterval(res => {
  console.log(res.seconds);
}).start();

// stop.
timer.stop();

// reset.
timer.reset();

Countdown

import DuckTimer from 'duck-timer';
const timer = new DuckTimer({ interval: 1000 });

timer.setCountdown(`Dec 25, ${new Date().getFullYear()}`)
  .onInterval(res => console.log(res.remain.seconds))
  .onTimeout(() => console.log('Merry Christmas!!!'))
  .start();

API

Please see DuckTimer API.

License

MIT License

1.0.3

2 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

5 years ago

0.4.9

6 years ago

0.4.8

6 years ago

0.4.7

6 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago