npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ngx-countdown-clock-workspace

v1.0.0

Published

`ngx-countdown-clock` is an Angular library for creating a customizable countdown timer with a progress bar and callback functionality. This component is ideal for e-commerce deals, quizzes, or any application requiring a countdown timer.

Downloads

7

Readme

ngx-countdown-clock

ngx-countdown-clock is an Angular library for creating a customizable countdown timer with a progress bar and callback functionality. This component is ideal for e-commerce deals, quizzes, or any application requiring a countdown timer.

Features

  • Customizable time format.
  • Ability to start, pause, and reset the timer.
  • Emits an event when the countdown ends.
  • Displays a progress bar for visual feedback.
  • Compatible with Angular 10 to the latest version.

Installation

Install the library via npm:

npm install ngx-countdown-clock

Usage

Import the Module

Add NgxCountdownClockModule to your application's module:

import { NgxCountdownClockModule } from 'ngx-countdown-clock';

@NgModule({
  declarations: [...],
  imports: [NgxCountdownClockModule],
})
export class AppModule {}

Basic Usage

Add the ngx-countdown-clock component to your template:

<ngx-countdown-clock [startTime]="60" (countdownComplete)="onCountdownEnd()"></ngx-countdown-clock>

In your component class:

export class AppComponent {
  onCountdownEnd(): void {
    console.log("Countdown completed!");
  }
}

Customizing the Timer

Setting the Countdown Start Time

Specify the start time in seconds using the startTime input:

<ngx-countdown-clock [startTime]="120"></ngx-countdown-clock>

Handling Countdown Completion

Use the countdownComplete output to execute actions when the timer reaches zero:

<ngx-countdown-clock [startTime]="90" (countdownComplete)="handleCompletion()"></ngx-countdown-clock>
handleCompletion(): void {
  alert('Time is up!');
}

Adding Start, Pause, and Reset Functionality

The component provides built-in methods to start, pause, and reset the timer:

<ngx-countdown-clock #countdown [startTime]="120"></ngx-countdown-clock>
<button (click)="countdown.start()">Start</button>
<button (click)="countdown.pause()">Pause</button>
<button (click)="countdown.reset()">Reset</button>

Customizing the Time Format

By default, the timer displays time in mm:ss format. To customize this, modify the formatTime method in your component:

private formatTime(seconds: number): string {
  const minutes = Math.floor(seconds / 60);
  const secs = seconds % 60;
  return `${minutes} minutes and ${secs} seconds`;
}

Styling

The component includes basic styles for the timer and progress bar. You can override these styles in your global or component-specific CSS.

Example:

ngx-countdown-clock .progress-bar {
  background-color: #ff5733;
}

ngx-countdown-clock .time-display {
  font-size: 2em;
  color: #333;
}

API Reference

Inputs

| Input | Type | Description | | ----------- | ------ | ---------------------------------------------- | | startTime | number | Initial countdown time in seconds. Default: 60 |

Outputs

| Output | Type | Description | | ------------------- | -------------------- | -------------------------------------- | | countdownComplete | EventEmitter<void> | Emits when the countdown reaches zero. |

Methods

| Method | Description | | --------- | --------------------- | | start() | Starts the countdown. | | pause() | Pauses the countdown. | | reset() | Resets the countdown. |


Compatibility

This library is compatible with Angular 10 and above.


License

MIT


Contributions

Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.