abortable interval via abort signals
npm i --save abortable-interval
// esm
import interval from 'abortable-interval'
// commonjs
const interval = require('abortable-interval').default
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
MIT