Package Exports
- @javelin/hrtime-loop
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@javelin/hrtime-loop) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@javelin/hrtime-loop
A tiny, high-resolution game loop for NodeJS 10+. Utilizes the setImmediate and setTimeout schedulers in conjunction to maintain a balance of precision and performance.
Installation
npm i @javelin/hrtime-loopUsage
import { createHrtimeLoop } from "@javelin/hrtime-loop"
const loop = createHrtimeLoop(1 / 60, clock => {
// (bigint) monotonic time
clock.time
// (number) time since last tick in ms
clock.dt
// (number) total number of ticks
clock.tick
})
// Start the loop
loop.start()
// Stop the loop
loop.stop()