Skip to main content

latest

Scheduling utilities for all runtimes.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
58%
Published
7 months ago (0.1.3)
class FrameLoop

A class to manage requestAnimationFrame loops.

Properties

A map of callback names to an array of performance times in milliseconds.

The maximum time a frame is allowed to take in milliseconds before a warning is logged.

readonly
iterationMetrics: { high: number; low: number; avg: number; frametimes: number[]; }

Get the current iteration metrics for the frame loop.

The name of the frame loop.

onUpdate: (callback: (delta: number) => void) => () => void

Register a callback to be called on each frame.

once: (callback: (delta: number) => void) => void

Register a callback to be called once on the next frame.

Whether to print frame loop performance metrics to the console.

start: () => unknown

Start the frame loop.

The interval in milliseconds at which to log a summary of the frame loop performance.

Add Package

deno add jsr:@build/scheduling

Import symbol

import { FrameLoop } from "@build/scheduling/frameloop";

---- OR ----

Import directly with a jsr specifier

import { FrameLoop } from "jsr:@build/scheduling/frameloop";

Add Package

npx jsr add @build/scheduling

Import symbol

import { FrameLoop } from "@build/scheduling/frameloop";

Add Package

yarn dlx jsr add @build/scheduling

Import symbol

import { FrameLoop } from "@build/scheduling/frameloop";

Add Package

pnpm dlx jsr add @build/scheduling

Import symbol

import { FrameLoop } from "@build/scheduling/frameloop";

Add Package

bunx jsr add @build/scheduling

Import symbol

import { FrameLoop } from "@build/scheduling/frameloop";