Skip to content

Library in TS to use Chronometer to coundown and count functions

License

Notifications You must be signed in to change notification settings

mugan86/chrono-countdown-count

Repository files navigation

Counter / CountdownTimer Library

npm version Build Status Coverage Status doc coverage License: MIT

This library use to execute count timer and countdown timer.

More details about use this project

Project that provides us with the functionalities of using an accountant or discounter that may be valid for games applications in which it requires to have a time control in an ascending or descending manner.

Examples that use this library:

We could use it in applications / games like:

  • Question and answer games of type Trivia in which we need to control the time per question and the total.
  • In Test / Surveys of limited time.
  • And much more.

Interest links

Instructions to install

npm install mugan86-chronometer

Intructions to use

Intructions to use Count Timer

const chrono = require('mugan86-chronometer');
const count = chrono.Counter;

// With clock format
const contar = new count(3, true);

// Contador
let counter = contar.start().subscribe(data => {
    console.log(data);
    if (data === 'FINISH') {
        counter.unsubscribe();
    }
});

// Expect results.
00:00:00
00:00:01
00:00:02
FINISH

// With NOT clock format
const contar = new count(3, false);

// Contador
let counter = contar.start().subscribe(data => {
    console.log(data);
    if (data === 'FINISH') {
        counter.unsubscribe();
    }
});

// Expect results.
0d 0h 0m 0s
0d 0h 0m 1s
0d 0h 0m 2s
FINISH

Intructions to use Countdown Timer

const chrono = require('mugan86-chronometer');
const count = chrono.CountDown;

// With clock format
const descontar = new count(3, true);

// Countdown timer
let counter = descontar.start().subscribe(data => {
    console.log(data);
    if (data === 'FINISH') {
        counter.unsubscribe();
    }
});

// Expect results.
00:00:03
00:00:02
00:00:01
FINISH

// With NOT clock format
const descontarNoClock = new count(3, false);

// Counter
let counter = descontarNoClock.start().subscribe(data => {
    console.log(data);
    if (data === 'FINISH') {
        counter.unsubscribe();
    }
});

// Expect results.
0d 0h 0m 3s
0d 0h 0m 2s
0d 0h 0m 1s
FINISH

Examples that use this library

Strangle App Game in Angular: https://mugan86.github.io/strangle-game-angular-widget/

About

Library in TS to use Chronometer to coundown and count functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published