1.0.1 • Published 7 years ago

cntdwn v1.0.1

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

Cntdwn

Cntdwn is a library that calculates the difference of time between an arbitrary date and the current date and executes a callback function each second passing the new difference of time.

Installation

Just run npm install cntdwn or yarn add cntdwn

Example

  const Cntdwn = require("cntdwn");

  const countdown = new Cntdwn(
    new Date(2019, 1, 1),
    (days, hours, minutes, seconds) => {
      console.log(days, hours, minutes, seconds);

      if(days < 10) {
        countdown.stop();
      }
  });

  countdown.start();