Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #4

Merged
merged 2 commits into from
Dec 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@

Small countdown timer and stopwatch module.

## install
## Installation
npm:
```shell
$ npm install tiny-timer
```
Yarn:
```shell
$ yarn add tiny-timer
```

## example
## Example
```javascript
const Timer = require('tiny-timer')

Expand All @@ -25,9 +30,9 @@ timer.on('statusChanged', (status) => console.log('status:', status))
timer.start(5000) // run for 5 seconds
```

# usage
## Usage

## `timer = new Timer({ interval: 1000, stopwatch: false })`
### `timer = new Timer({ interval: 1000, stopwatch: false })`
Optionally set the refresh `interval` in ms, or `stopwatch` mode instead of countdown.

### `timer.start(duration [, interval])` {
Expand All @@ -43,7 +48,7 @@ Pauses timer.
### `timer.resume()`
Resumes timer.

## events
## Events

### `timer.on('tick', (ms) => {})`
Event emitted every `interval` with the current time in ms.
Expand All @@ -54,7 +59,7 @@ Event emitted when the timer reaches the `duration` set by calling `timer.start(
### `timer.on('statusChanged', (status) => {})`
Event emitted when the timer status changes.

## properties
## Properties

### `timer.time`
Gets the current time in ms.
Expand Down