fn

useFps

testeddemo

Reactive FPS counter based on requestAnimationFrame. Reports a smoothed FPS value averaged over a configurable number of frames, and tracks min/max values.

Example

ts
const { fps, min, max, reset } = useFps();

Demo

Loading demo…

Signature

ts
export function useFps(options: UseFpsOptions ={ ... }

Parameters

ParameterTypeDescription
options?UseFpsOptionsConfiguration options

Returns

UseFpsReturn
PropertyTypeDescription
fpsReadonly<Ref<number>>Current frames per second (averaged over the last every frames)
minReadonly<Ref<number>>Minimum FPS recorded since the composable was created or last reset
maxReadonly<Ref<number>>Maximum FPS recorded since the composable was created or last reset
isActiveReadonly<Ref<boolean>>Whether the FPS counter is currently active
reset() => voidReset min/max tracking