1.0.0 • Published 3 years ago

abortable-interval v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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