https://github.com/dighan/tickr
No dependencies, tiny and customizable JavaScript library to execute code repeatedly with fixed or dynamic delay.
https://github.com/dighan/tickr
delay setinterval timer
Last synced: 10 months ago
JSON representation
No dependencies, tiny and customizable JavaScript library to execute code repeatedly with fixed or dynamic delay.
- Host: GitHub
- URL: https://github.com/dighan/tickr
- Owner: dighan
- License: mit
- Created: 2017-12-29T12:41:53.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-29T18:32:08.000Z (about 8 years ago)
- Last Synced: 2025-02-17T01:41:23.147Z (about 1 year ago)
- Topics: delay, setinterval, timer
- Language: JavaScript
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Tickr [](https://travis-ci.org/dighan/tickr)
No dependencies, tiny (`<2kB`) and customizable JavaScript library to execute code repeatedly with fixed or dynamic delay.
**Tickr** is subject to the [background browser mechanism](https://developers.google.com/web/updates/2017/03/background_tabs) and
cannot guarantee the `delay` is always honoured between ticks.
## Installation
Install the stable version with [`npm`](https://docs.npmjs.com/getting-started/what-is-npm):
```shell
npm install TBD --save-dev
```
or include it with a [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) tag:
```html
<script src="TBD" async>
```
## Usage
Intended to be bundled:
```js
import createTicker from 'Tickr'
const ticker = createTicker({ delay: 250 }, function() {
console.log(
ticker.getDelay(),
ticker.getImmediate(),
ticker.getMaxTicks()
)
}).start()
```
or in the browser:
```js
const ticker = Tickr.createTicker({ delay: 250 }, function() {
console.log(
ticker.getDelay(),
ticker.getImmediate(),
ticker.getMaxTicks()
)
}).start()
```
## License
MIT