Skip to content

@whittakertech/mosaic / canTransition

Function: canTransition()

ts
function canTransition(from, to): boolean;

Defined in: state.ts:62

Determines whether a transition between two lifecycle states is valid.

This function enforces MosaicJS’s deterministic state machine.

Parameters

from

MosaicState

The current lifecycle state

to

MosaicState

The proposed next lifecycle state

Returns

boolean

true if the transition is permitted, false otherwise

Remarks

Invalid transitions are rejected by Mosaic.setState and emit a mosaic:error event.