1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-12 08:38:10 +00:00

core/Window: simplify fps calc

This commit is contained in:
Sotiri Bakagiannis 2021-02-15 18:33:07 +00:00
parent 5408f4c2dd
commit 0d56e598d3

View File

@ -148,10 +148,7 @@ export class Window extends PsychObject
{
// gets updated frame by frame
const lastDelta = this.psychoJS.scheduler._lastDelta;
const fpsMaybe = 1000 / lastDelta;
// NB: calling `Number.isFinite()` might skip the implicit to number conversion, but
// would also need polyfilling for IE
const fps = isFinite(fpsMaybe) ? fpsMaybe : 60.0;
const fps = lastDelta === 0 ? 60.0 : 1000 / lastDelta;
return fps;
}