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 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-cd-timer

v3.0.0

Published

Cd-Timer is a Angular CLI component with countup, countdown and multiple options.

Downloads

22,920

Readme

Angular-Cd-Timer

This is a simple, re-usable and inter-operable timer component for Angular CLI with multiple options.

cd-timer is able to:

  • count up / count down.
  • manage start time and end time.
  • manage several displaying format.

Demo

Demo is available on this site: http://angular-cd-timer.clemdesign.fr/

Compatibilities

| Angular version | Library version | |-----------------|-----------------| | 4+ | 1.X.X | | 12+ | 2.X.X | | 13+ | 3.X.X |

Installation

Execute npm install angular-cd-timer

Usage

cd-timer count every seconds.

Configuration

Import the module as standard Angular module import:

import { CdTimerModule } from 'angular-cd-timer';

@NgModule({
  // ...,
  imports: [
    // ...,
    CdTimerModule
  ],
  // ...
})
export class AppModule { }

Basic usage

This simple integration <cd-timer></cd-timer> will start the timer with the default options of ticking every 1 second.

Attributes

cd-timer has the following attributes:

  • [startTime]: Define the start time (tick count) in second. Default: 0.
  • [endTime]: Define the end time (tick count) in second. Default: 0 (Not enabled).
  • [countdown]: Countdown if set to true. Default: false.
  • [autoStart]: Autostart timer if set to true. Default: true.
  • maxTimeUnit: Define the maximum unit allowed. Default: 'day'.
    • day: Timer count up to day. Ex: 2d 12h 04m 12s.
    • hour: Timer count up to hour. EX: 00d 60h 04m 12s.
    • minute: Timer count up to minute. EX: 00d 00h 3604m 12s.
    • second: Timer count up to minute. EX: 00d 00h 00m 216252s.
  • format: Display timer count in predefined format. Default: 'user' or 'default'.
    • default: Display like 0d 0h 0m 0s.
    • hms: Display like HH:MM:SS.
    • ms: Display like [HH]:MM:SS. Hours are shown just when the timer pass the first 60 minutes.
    • intelli: Display in condensed format:
      • only seconds: 25s
      • minutes and seconds: 02min 12s
      • hours and minutes: 10h 21min
      • days and hours: 2days 12min
    • user: Display according user markup in <cd-timer></cd-timer>:
      • [seconds]: display seconds
      • [minutes]: display minutes
      • [hours]: display hours
      • [days]: display days

Callbacks

cd-timer has the following callbacks (event emitter):

  • (onComplete): Called when tick count reach endTime or 0. Argument is CdTimerComponent.
  • (onTick): Called each tick count. Argument is TimeInterface.
  • (onStart): Called when timer starts. Argument is CdTimerComponent.
  • (onStop): Called when timer stop. Argument is CdTimerComponent.

Public methods

cd-timer is controlable by the following public methods:

| Method name | Description | |:----------- |:----------------------------------------------- | | start() | Start timer from 0. | | stop() | Stop timer. | | resume() | Resume timer from the last tick count. | | reset() | Stop and reset timer. | | get() | Get time information by TimeInterface object. |

Timer shall be bind with @ViewChild() in Angular App.

Contribution

We welcome any or all kinds of contributions! Please submit [pull requests](https://github.com/clemdesign/angular-cd-timer/pulls or create issues to contribute to this project :)

License

Under MIT Copyright (c) 2018-2021 clemdesign