Skip to content

Commit

Permalink
Return DOMHighResTimeStamp to callback
Browse files Browse the repository at this point in the history
  • Loading branch information
yandeu committed Oct 10, 2023
1 parent 2bf780e commit 9e7bf98
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ global.URL.revokeObjectURL = () => {}
global.phaserOnNodeFPS = 60

const animationFrame = (cb: any) => {
const now = performance.now()
if (typeof cb !== 'function') return 0 // this line saves a lot of cpu
window.setTimeout(() => cb(0), 1000 / global.phaserOnNodeFPS)
window.setTimeout(() => cb(now), 1000 / global.phaserOnNodeFPS)
return 0
}
export { animationFrame }
Expand Down

0 comments on commit 9e7bf98

Please sign in to comment.