Socket
Socket
Sign inDemoInstall

raf-loop

Package Overview
Dependencies
5
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    raf-loop

a minimal requestAnimationFrame render loop


Version published
Maintainers
1
Install size
74.5 kB
Created

Readme

Source

raf-loop

stable

A minimal requestAnimationFrame render loop for node and the browser, using high-performance timing where possible.

var loop = require('raf-loop')

var engine = loop(function(dt) {
    // delta time in milliseconds 
}).start()

Usage

NPM

engine = loop([fn])

Creates a new loop with an optional function to receive tick events. The function will be called with delta time as the first parameter, in milliseconds.

engine.start()

Starts the render loop and returns this engine, for chaining.

engine.stop()

Stops the render loop and cancels the currently requested animation frame.

engine.on('tick', fn)

Attaches another function to the render loop.

License

MIT, see LICENSE.md for details.

Keywords

FAQs

Last updated on 29 May 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc