Package Exports
- @dotmh/tick
- @dotmh/tick/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dotmh/tick) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
DotMH Tick.
DotMH Tick is designed for making polling loops when needed easier.
Installation
npm i @dotmh/tickUsage
To use Tick you first have to require it.
const Tick = require('@dotmh/tick')Then create a new instance of the class
const tick = new Tick();Then set up tick
tick.every('2ms').start(() => console.log('hello world'));You can stop the tick with
tick.stop()You can also set a condition which mean the callback will be called if the condition function return true.
tick.every('2s').when(() => true).start(() => console.log('do something'));See vercel/ms to see more about the format for the time string.