Screen helpers · function

isDuplicateFrame

Whether a frame read at presentedCount repeats the one composed at lastPresentedCount.

Explained in Recording and clips.

function isDuplicateFrame(lastPresentedCount: number | null, presentedCount: number): boolean
import { isDuplicateFrame } from '@driftengine/core';

Parameters

ParameterTypeDescription
lastPresentedCountnumber | null
presentedCountnumber

In depth

null says nothing has been composed yet, so a first frame is never a duplicate of a frame that never happened — a literal 0 there would misread the renderer's own starting count as a repeat of it. Pulled out of compose() on purpose: it is the one piece of that method's job that touches no canvas, so it is the one piece a test can hold to account without a DOM — this repository's tests run in node, per vitest.config.ts, and ExportTarget itself creates a real <canvas> at construction.