Pure JavaScript timer plugin
NPM
npm install timers.js --saveIn Node.js
require('timers.js')Direct download from latest releases
Include
<script src="dist/js/timers.js"></script>Initialize
new Timer();new Timer({
// Options here
property: value,
...
});| Property | Description | Available values | Default value |
|---|---|---|---|
| el | Timer.js element | Element selector (string) | '.timer' |
| time.second | Set initial second | integer | 0 |
| time.minute | Set initial minute | integer | 0 |
| time.hour | Set initial hour | integer | 0 |
| isStoped | Set timer status | boolean | false |
| Method | Description |
|---|---|
| .get('second|minute|hour') | Get the current time |
| .set('second|minute|hour', value) | Set time |
| .pause() | Pause the timer |
| .stop() | Stop the timer |
| .resume() | Resume the timer |