Packaging · function

hostBridge

The engine's capability interfaces, implemented over the shell's one bridge.

Explained in Packaging an application.

function hostBridge(): DriftHostBridge | null
import { hostBridge } from '@driftengine/package';

In depth

Each of these is the native half of a pair whose browser half ships in the engine. The pairs differ in exactly the places a browser cannot answer honestly: a refresh rate is a number here and null there, and quitting works here and warns there.

A game is one bundle. hostBridge() answers null in a plain browser rather than throwing, so a consumer picks its implementations at boot and ships the same code to both.