angular-countdown

WebJar for angular-countdown

License

License

MIT
Categories

Categories

Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

angular-countdown
Last Version

Last Version

1.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

angular-countdown
WebJar for angular-countdown
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/bendrucker/angular-countdown

Download angular-countdown

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/angular-countdown/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>angular-countdown</artifactId>
    <version>1.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/angular-countdown/
implementation 'org.webjars.bower:angular-countdown:1.2.1'
// https://jarcasting.com/artifacts/org.webjars.bower/angular-countdown/
implementation ("org.webjars.bower:angular-countdown:1.2.1")
'org.webjars.bower:angular-countdown:jar:1.2.1'
<dependency org="org.webjars.bower" name="angular-countdown" rev="1.2.1">
  <artifact name="angular-countdown" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='angular-countdown', version='1.2.1')
)
libraryDependencies += "org.webjars.bower" % "angular-countdown" % "1.2.1"
[org.webjars.bower/angular-countdown "1.2.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bower : angular jar [1.3.0,2)

Project Modules

There are no modules declared in this project.

angular-countdown Build Status

Radial countdown component for Angular built with SVG.

angular-countdown example with terrible frame rate

Installing

# npm
npm install angular-countdown
# bower
bower install angular-countdown
angular.module('myApp', [
  require('angular-countdown')
]);
// or with script tags
angular.module('myApp', [
  '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.

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>

<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

Versions

Version
1.2.1