class / @typed/template/RenderQueue

MixedRenderQueue

A composite RenderQueue that directs tasks to different queues based on their priority.

  • High priority: Sync
  • Medium priority: RAF (or setTimeout fallback)
  • Low priority: IdleCallback (or setTimeout fallback)
Package version
1.0.0-beta.7
Category
Mixed scheduling
Since
1.0.0

Import

import { MixedRenderQueue } from "@typed/template/RenderQueue";

Signatures

export declare class MixedRenderQueue extends RenderQueue {
    constructor(durationAllowed?: number);
    readonly add: (key: unknown, task: () => void, dispose: () => void, priority: number) => Disposable;
    [Symbol.dispose]: () => void;
}

Why

One default queue adapts to platform capabilities while preserving explicit priority semantics.

Ownership and lifetime

The instance exclusively owns its synchronous, frame/timer, and idle/timer child queues. Disposing it disposes all three and their pending callbacks.

Constructor

Creates a capability-adaptive queue with one visual-work budget.

Constructor: Why

Selects frame/idle APIs when present and timers otherwise.

Constructor: Ownership and lifetime

The instance owns all three child queues until disposal.

Property: [[computed:[Symbol.dispose]]]

Disposes every child scheduler and its pending entries.

Property: [[computed:[Symbol.dispose]]]: Why

Mixed scheduling remains one deterministic resource boundary.

Property: [[computed:[Symbol.dispose]]]: Ownership and lifetime

Ends the lifetime of all pending sync/frame/timer/idle work.

Property: add

Routes one keyed task to the scheduler selected by its numeric priority.

Property: add: Why

Callers choose urgency without knowing browser capability details.

Property: add: Ownership and lifetime

The selected child queue owns the entry until execution or disposal.

Examples

import { MixedRenderQueue, RenderPriority } from "@typed/template/RenderQueue"

const queue = new MixedRenderQueue()

// Tasks are automatically routed to the appropriate queue
queue.add("sync", () => {}, () => {}, RenderPriority.Sync)
queue.add("raf", () => {}, () => {}, RenderPriority.Raf(5))
queue.add("idle", () => {}, () => {}, RenderPriority.Idle(1))

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source