Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including component-counter with all npm packages installed. Try it out:

var componentCounter = require("component-counter")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

component-counter v1.1.0

Simple counter component

Counter

Counter component.

js apple style countdown counter component

Installation

$ npm i component-counter

API

new Counter([element], [options])

Initialize a new counter on an optional element with optional options.

var Counter = require('component-counter');
var counter = new Counter();
document.documentElement.appendChild(counter.el);

Options

digitClass

A class to add to each digit.

digits

Initial digits number to create.

Counter.prototype.digits(n)

Set the total number of digits to n.

Counter.prototype.addDigit()

Add a digit element.

Counter.prototype.ensureDigits()

Ensure at least n digits are available.

Counter.prototype.updateDigit(i, val)

Update digit i with val.

Counter.prototype.update(n)

Update count to n.

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free