Core · class

MessageQueue

Explained in The loop.

class MessageQueue<T extends QueuedMessage = QueuedMessage>
import { MessageQueue } from '@driftengine/core';

Constructor

new

constructor(options?: MessageQueueOptions)
ParameterTypeDescription
options?MessageQueueOptions

Accessors

NameTypeDescription
currentgetT | null

Methods

push

push(message: T): void
ParameterTypeDescription
messageT

update

update(nowMs: number): T | null

Advance. Returns a message only on the frame it becomes current, so the caller can render it once rather than diffing against what it drew last.

ParameterTypeDescription
nowMsnumber

clear

clear(): void

Drop everything, including what is on screen — as a restart must.