1.0.0 • Published 2 years ago

@lancercomet/fps-counter v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

@lancercomet/fps-counter

MyWebLibs npm version

A library to read fps.

Quick start

import { FpsCounter } from '@lancercomet/fps-counter'

const fpsCounter = new FpsCounter()
const unregisterTick = fpsCounter.onTick((fps: number) => {
  console.log('Fps:', fps)  
})
fpsCounter.start()

// Unregister tick from FpsCounter:
unregisterTick()

// Stop counting:
fpsCounter.stop()

// Read fps directly:
fpsCounter.fps

onTick triggers every frame.

You can pass use your own throttle function to take it easy.

License

Apache-2.0

1.0.0

2 years ago