1.0.18 • Published 3 years ago

framerate-history v1.0.18

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Framerate History

An ES6 class for tracking framerate for a given period of time.

npm deps size vulnerabilities license

Installation

npm install framerate-history

FrameRate

import FrameRate from 'framerate-history';

new FrameRate(settings)

ParamTypeDefault
settingsObject
settings.onSamplefunction
settings.filterStrengthNumber5
settings.historyDurationNumber30
settings.sampleRateNumber10

frameRate.fps ⇒ Number     🔒 Read only

The last recorded FPS

frameRate.history ⇒ Array     🔒 Read only

The FPS recordings over the history duration

frameRate.filterStrength(value) ⇒ Number     🔗 Chainable

Sets a filter on the frame rate calculation. Setting to 1 will effectively turn off the filter, the higher the number the more smooth the curve over time. See this stackoverflow question for details: https://stackoverflow.com/questions/4787431/check-fps-in-js

Default: 5

ParamType
valueNumber

frameRate.sampleRate(value) ⇒ Number     🔗 Chainable

The rate to take samples. Setting to 0 will clear the interval. If the interval is prevented from executing at the desired rate, the history will get filled in with the current frame rate in an attempt to keep the history as accurate as possible.

Default: 10

ParamTypeDescription
valueNumberSamples per second

frameRate.onSample(callback) ⇒ function     🔗 Chainable

The callback will get called for every sample taken.

ParamTypeDescription
callbackfunctionThe callback is given one param, the FPS history array.

frameRate.historyDuration(value) ⇒ Number     🔗 Chainable

Defines the duration of tracked history.

Default: 30

ParamTypeDescription
valueNumberSeconds
1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago