0.1.2 • Published 6 years ago

request-timer v0.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

request-timer

The timer implemented by requestAnimationFrame for better performance.

How to use

import {
  requestTimeout, clearRequestTimeout,
  requestInterval, clearRequestInterval
} from 'request-timer'

// delay for 200ms
const timerId = requestTimeout(() => {
  // do something cool
}, 200)

// clear timeout if necessary
clearRequestTimeout(timerId)

// execute something every 200ms
const timerId = requestInterval(() => {
  // do something cool  
}, 200)

// clear interval if necessary
clearRequestInterval(timerId)

It could be used just like setTimeout and setInterval.

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago