1.1.0 • Published 5 years ago

madrick-countdown-timer v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Madrick Countdown Timer

Simple javascript function to make a countdown timer

Github repository!

Getting Started

Installing

Using npm:

npm i madrick-countdown-timer

In angular.component.ts:

import mct from 'madrick-countdown-timer';

...

countdown = {
    days: 0,
    hours: 0,
    minutes: 0,
    seconds: 0,

    status: 0,
    message: ''
};

...

ngOnInit() {
    // params[1] = string date and time
    // params[2] = callback function
    // params[3] = options, see table documentation bellow
    mct.countdown('Jan 5, 2019 13:47:25', (countdown) => {
        // countdown = { 
        //   days, hours, minutes, seconds,
        //   status [0 -> expired / 1 -> counting],
        //   message ['EXPIRED' / 'COUNTING']
        // }

        this.countdown = countdown;
    }, { format: 'dhms' });
}

In angular.component.html

{{countdown.days}}d - {{countdown.hours}}h - {{countdown.minutes}}m - {{countdown.seconds}}s

Options

OptionsValues
format'dhms' => X days, 24 hours, 60 minutes, 60 seconds (default)'hms' => 0 day, X hours, 60 minutes, 60 seconds
1.1.0

5 years ago

1.0.1

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago