Skip to main content

Interface: ScreenStateSource

Defined in: packages/player/src/screen-state.ts:13

A source of truth for "can anything this app draws actually be seen".

Remarks

Deliberately an interface rather than a concrete object: it is what makes the gate unit-testable without a device, and it is the escape hatch for an integration whose idea of "presenting" is not the device display (an external screen, a car head unit, a Live Activity). See setScreenStateSource.

Properties

interactive

readonly interactive: boolean;

Defined in: packages/player/src/screen-state.ts:15

true while the display is on. Read, never cached, by the consumer.

Methods

subscribe()

subscribe(listener: (interactive: boolean) => void): () => void;

Defined in: packages/player/src/screen-state.ts:24

Observe transitions.

Parameters

ParameterTypeDescription
listener(interactive: boolean) => voidCalled with the new value on every change, never with the current one — read interactive for that.

Returns

A function that removes this listener. The underlying platform receiver is derived from the listener set, so the last removal releases it.

() => void