Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pakej/simple-timer-js
A simple timer to show timer countdown on websites.
https://github.com/pakej/simple-timer-js
javascript npmjs simple timer yarn
Last synced: 3 months ago
JSON representation
A simple timer to show timer countdown on websites.
- Host: GitHub
- URL: https://github.com/pakej/simple-timer-js
- Owner: pakej
- License: apache-2.0
- Created: 2016-10-23T19:09:57.000Z (about 8 years ago)
- Default Branch: develop
- Last Pushed: 2019-12-13T14:45:22.000Z (about 5 years ago)
- Last Synced: 2024-09-28T15:21:07.061Z (4 months ago)
- Topics: javascript, npmjs, simple, timer, yarn
- Language: JavaScript
- Homepage:
- Size: 23.4 KB
- Stars: 7
- Watchers: 5
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# SimpleTimer for JavaScript
![npm](https://img.shields.io/npm/v/simple-timer-js)A simple timer to show timer countdown on websites.
## Installation
### Yarn
```bash
$ yarn add simple-timer-js
```### NPM
```bash
$ npm install simple-timer-js
```## Usage
1. Require the `SimpleTimer`
```javascript
var SimpleTimer = require("simple-timer-js");
````1. Create a new SimpleTimer instance with the expected `duration`, `timerContainer`, `originalText`.
```javascript
var timerDurationInSeconds = 60;
var uniqueTimerContainerClassName = "timer-container";
var originalTextInContainer = "";
var timer = new SimpleTimer(timerDurationInSeconds, uniqueTimerContainerClassName, originalTextInContainer);
```1. Call `startTimer()` to start the timer.
```javascript
timer.startTimer();
```1. If you want to force end the timer, simply call `endTimer()`. Otherwise, the timer will stop on its own, after it reaches the given `timerDuration`.
```javascript
timer.endTimer();
```## Contributing
We'd love to accept your patches and contributions to this project! Checkout [contributing](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) to learn more.## License
Refer to the license file.