Skip to content

batata-frita/collect-fps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collect FPS

Build Status npm version

Small module that uses requestAnimationFrame to collect what is the current FPS.

Usage

First install it:

npm install --save collect-fps

Calling it will initialize the collection and return a function. When invoked, that function will stop the collection and return the frame per seconds value (a float number).

import collectFPS from 'collect-fps'

const endCollection = collectFPS()

setTimeout(() => {
  const fps = endCollection()
  console.log(fps)
}, 1000)

If requestAnimationFrame is not available in your runtime, it will throw an error when invoked

License

MIT