Skip to main content

SyncedObservableOptions<T>

Defined in: src/lib/observable/types.ts:250

Options for synchronized observables (serverOwned, clientOwned, shared).

Extends

Extended by

Type Parameters

Type Parameter
T

Properties

PropertyTypeDescriptionInherited fromDefined in
broadcast?booleanIf true, all connected players are automatically subscribed. If false (default), players must be manually subscribed. Default falseObservableOptions.broadcastsrc/lib/observable/types.ts:63
equals?(a: T, b: T) => booleanCustom equality function to determine if value has changed. Defaults to strict equality (===).ObservableOptions.equalssrc/lib/observable/types.ts:73
idstringUnique identifier for this observable. Used for RPC event naming and debugging. Format: "moduleName:observableName"ObservableOptions.idsrc/lib/observable/types.ts:50
initialValueTInitial value of the observable.ObservableOptions.initialValuesrc/lib/observable/types.ts:55
noResponse?booleanIf true, use fire-and-forget mode for sync updates. Faster but no guarantee of delivery. Default true-src/lib/observable/types.ts:257
perPlayer?booleanIf true, this observable is per-player (each player has their own value). - On server: Multiple instances can exist with the same base ID. Use subscribePlayer(playerId) to subscribe and sync to a specific player. - On client: The observable automatically receives values sent to this client. No need to know the player's server ID. The sync event name uses the base ID (without player ID suffix), and FiveM's emitNet targets the specific player. Default false-src/lib/observable/types.ts:272
syncDebounceMs?numberDebounce sync updates by this many milliseconds. Useful for frequently changing values. Default 0 (no debounce)ObservableOptions.syncDebounceMssrc/lib/observable/types.ts:81