# angular-countdown

> Radial countdown timer for Angular

Latest version **1.2.1** (published 2015-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular-countdown
pnpm add angular-countdown
yarn add angular-countdown
bun add angular-countdown
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2015-03-12 |
| First published | 2015-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+10 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | angular, countdown, radial, animated |

## Links

- npm: https://www.npmjs.com/package/angular-countdown
- Repository: https://github.com/bendrucker/angular-countdown
- Issues: https://github.com/bendrucker/angular-countdown/issues
- npm.io page: https://npm.io/package/angular-countdown

## Dependencies (5)

- [angular](https://npm.io/package/angular.md) ^1.3.0
- [babelify](https://npm.io/package/babelify.md) ~5.0.3
- [insert-css](https://npm.io/package/insert-css.md) ~0.2.0
- [partialify](https://npm.io/package/partialify.md) ~3.1.3
- [browserify-shim](https://npm.io/package/browserify-shim.md) ~3.8.2

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 1.2.1 (latest) — 2015-03-12
- 1.2.0 — 2015-02-25
- 1.1.0 — 2015-02-25
- 1.0.1 — 2015-02-21
- 1.0.0 — 2015-02-21

## README

# angular-countdown [![Build Status](https://travis-ci.org/bendrucker/angular-countdown.svg?branch=master)](https://travis-ci.org/bendrucker/angular-countdown)

Radial countdown component for Angular built with SVG.

![angular-countdown example with terrible frame rate](http://f.cl.ly/items/002W2S362V2u1I1l292b/Screen%20Recording%202015-02-20%20at%2009.21%20PM.gif)

## Installing

```sh
# npm
npm install angular-countdown
# bower
bower install angular-countdown
```

## API

angular-countdown provides two interfaces designed to be used together:

1. A `CountdownTimer` service which you'll typically inject into your controllers to create new timers
2. A `<countdown>` directive which consumes the `CountdownTimer` instances you'll create

### `CountdownTimer`

##### `new CountdownTimer(length [, options])`

Creates a new countdown `timer` with the given `length` (milliseconds). `options` may include:

`tickInterval`: a `Number` that specifies how often to update the radial countdown in milliseconds. Defaults to `15`.

A `CountdownTimer` is an [`EventEmitter`](http://nodejs.org/api/events.html). 

##### `timer.start()` -> `timer`

Starts the `timer`. At each interval (as defined by `options.tickInterval`), the `timer` will emit a `'tick'` event with one argument: the proportion of the tick to the `length`. So if you start a timer for 1.5 seconds, ticking every 15ms, each tick is 15/1500 or 1/100.

When the `length` has passed, the `timer` will emit a `'done'` event. 

##### `timer.cancel()` -> `timer`

Cancels the `timer` and cleans up the `$interval` backing it. Emits a `'done'` event.

### `<countdown>`

```html
<countdown timer="timer" radius="15" stroke="5"></countdown>
```

The `<countdown>` directive accepts three parameters: the `timer` to bind to, the `radius` of the timer circle, and the `width` of the stroke. It builds the SVG needed to create the radial timer effect.

For an example, run `npm run example`. 

## Credits

Inspired by [svgPieTimer.js](https://github.com/agrimsrud/svgPieTimer.js)

---
_Source: https://npm.io/package/angular-countdown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
