Interface: GameStateChangedEvent<T>

Information delivered for one accepted game-state change.

Type Parameters

T

T = SyncedObject

Properties

affects

readonly affects: (...path) => boolean

Returns whether this change affects a path or anything above or below it. Call with no segments to match any change to the root object.

Parameters

path

...SyncedObjectPath

Returns

boolean

Example

if (event.affects('round', 'phase')) {
  renderPhase(event.current.round.phase)
}

changedPaths

readonly changedPaths: SyncedObjectChangedPaths

The complete invalidation set prepared by Plot. Every actual difference is covered and every reported path identifies a subtree that differs. To keep work bounded, Plot may collapse many descendants to their differing ancestor; an empty path identifies the root object. Prefer affects when deciding whether to update a specific feature.


current

readonly current: ImmutableSynced<T>

The current complete immutable game state.


previous

readonly previous: ImmutableSynced<T>

The complete game state before this change.


reason

readonly reason: SyncedObjectChangeReason

Whether this SDK initiated the accepted change.


revision

readonly revision: number

The accepted revision of the current game state.