An open API service indexing awesome lists of open source software.

https://github.com/brikcss/timer

Simple timer utility to start, stop, check duration, and clear a timer. Works in Node, JS/UMD modules, or the browser.
https://github.com/brikcss/timer

Last synced: about 2 months ago
JSON representation

Simple timer utility to start, stop, check duration, and clear a timer. Works in Node, JS/UMD modules, or the browser.

Awesome Lists containing this project

README

        

# Timer

> Simple timer utility to start, stop, check duration, and clear a timer. Works in Node, JS/UMD modules, or the browser.




NPM version



NPM downloads per month



Travis branch



NPM version



Coverage Status



Commitizen friendly



semantic release



code style: prettier



## Install

```sh
npm install @brikcss/timer --save-dev
```

## Usage

**`timer.start(id)`**

Start a new or existing timer. Creates one if it doesn't exist. Returns the newly created timer object.

**`timer.stop(id)`**

Stop an existing timer. Returns the timer's duration as a string.

**`timer.duration(id)`**

Get the duration of a timer. Returns a string in `ms` or `s`.

**`timer.clear(id)`**

Clear / remove a timer from memory.

## Environment support

| Node | CLI | UMD | ES Module | Browser |
|:------:|:-----:|:-----:|:---------:|:---------:|
| ✔ | x | ✔ | ✔ | ✔ |