counting-js

1.0.11 • Public • Published

npm npm bundle size NPM Downloads

counting-js

A lightweight library that counts

counting-js weighs in at 1.8KB, and provides a function with a simple API

Installation

Via NPM: npm i counting-js

Usage

You can include counting-js to use in your JavaScript file with:

import Count from 'counting-js';

Your JavaScript can be include in HTML:

<script type="module" src="./app.js"></script>

See the demo directory for an example.

Parameters

The Count function takes two parameters: id, which is the id of the element to count as a string, and countSpeed, which is the speed, in milliseconds at which to count.

If there is element with the id of foo that should count at 50ms, a call to Count would look like: Count('foo', 50);

The value to count to is taken from the inner HTML of the element with the given id, which must be a number, and it will count from 0.

Contributions

This code is a work in progress, and contribuions and suggestions for improvements are welcome.

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i counting-js

    Weekly Downloads

    1

    Version

    1.0.11

    License

    MIT

    Unpacked Size

    10 kB

    Total Files

    8

    Last publish

    Collaborators

    • jaredforth