abortable-interval
v1.0.0
Published
abortable interval
Downloads
2
Maintainers
Readme
abortable-interval
abortable interval via abort signals
Installation
npm i --save abortable-interval
Usage
Supports both ESM and CommonJS
// esm
import interval from 'abortable-interval'
// commonjs
const interval = require('abortable-interval').default
Example
import interval from 'abortable-interval'
const controller = new AbortController()
const signal = controller.signal
interval(1000, signal, () => {
console.log('interval', Date.now())
})
controller.abort() // clears interval
License
MIT