@abernier/loop

1.0.4 • Public • Published

NPM version

INSTALL

import Loop from 'https://unpkg.com/@abernier/loop@1.0.4'

Usage

At max speed (requestAnimationFrame):

const myLoop = new Loop((t1, t0) => {
  console.log(`dt: ${t1 - t0}`)
})

myLoop.start()

// ...

myLoop.stop()

At given speed (setTimeout):

const myLoop = new Loop((t1, t0) => {
  console.log(`dt: ${t1 - t0}`)
}, 1000)

myLoop.start()

// ...

myLoop.stop()

/@abernier/loop/

    Package Sidebar

    Install

    npm i @abernier/loop

    Weekly Downloads

    6

    Version

    1.0.4

    License

    ISC

    Unpacked Size

    3.81 kB

    Total Files

    4

    Last publish

    Collaborators

    • abernier