1.0.2 • Published 1 year ago

@ngxarch/countdown v1.0.2

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

Reactive Countdown

Countdown utility. This library is for you whenever you need a reactive countdown or timer.

Usage

// Basic
const countdown = new Countdown({
  intervalInSeconds: 5,
  onComplete: () => {
    // Your code here gets called when the countdown has finished.
    // eg. emit to an Subject
  },
});

Start a countdown

Countdown exposes an observable, as soon as we have a subscriber we can start the countdown.

countdown.secondsLeft$.subscribe();
countdown.start();

Stop/Reset a countdown

Stop will reset the countdown to its configured interval in seconds.

countdown.stop();

Properties

PropertyDescription
secondsLeft$As soon as we have a subscriber to this property we can start the countdown.
onComplete$Emits when the countdown completes
isRunning$Observe if the countdown is running
isStopped$Observe if the countdown is stopped
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago