Screen helpers · function

splashDecision

When the badge gives the screen to the game. Two conditions and a cap, each for a named failure.

Explained in Recording and clips.

function splashDecision(elapsedMs: number, minMs: number, contentReady: boolean, capMs?: number): SplashDecision
import { splashDecision } from '@driftengine/core';

Parameters

ParameterTypeDescription
elapsedMsnumber
minMsnumber
contentReadyboolean
capMs?number

In depth

  • The game has painted, and every promise it asked the badge to wait for has settled (holdSplash). Swapping before that shows the empty canvas, or the half-loaded first screen, the badge exists to cover.
    • The minimum has passed. A badge that vanishes the instant a fast machine paints is a flicker, and the machines that boot fastest are the ones a developer tests on.
    • The cap overrides both, and is checked first so that a minimum longer than the cap cannot pin the screen. Past it the game is shown in whatever state it is in, because a broken game that can be seen is better than a brand that cannot be dismissed.

Pure, so all three are testable without a browser: the caller owns the clock. This is the second copy of the rule — @driftengine/package's runs in Electron's main process, which cannot import this engine — and splash.test.ts says why that duplication is deliberate.