Skip to content
FMFallout Multiplayer Scripting APIScripting guides and API
Data shapeClient APIGenerated

EventBus

Defined in: client/api.d.ts:2559

Asynchronous resource event bus.

emit(eventName, …args): Promise<void>

Defined in: client/api.d.ts:2610

Invokes every shared handler and waits for all synchronous and asynchronous results.

string

Shared event name.

…unknown[]

Arguments delivered to every matching handler.

Promise<void>

Promise rejected with an AggregateError when one or more handlers fail.


emitLocal(eventName, …args): Promise<void>

Defined in: client/api.d.ts:2634

Emits an event only within the calling resource.

string

Private local event name.

…unknown[]

Arguments delivered only to handlers owned by the calling resource.

Promise<void>

Promise rejected when one or more local handlers fail.


emitServer(eventName, payload?): void

Defined in: client/api.d.ts:2648

Sends a named event from this client to the server’s isolated onClient handlers.

string

Server-side client-event name.

unknown

Optional payload. A string is sent as is and must already be JSON text: the server parses it and drops an event that does not parse. Other values are JSON-serialized.

void


emitTo(resourceName, eventName, …args): Promise<void>

Defined in: client/api.d.ts:2619

Invokes matching handlers belonging only to one resource.

string

Destination running resource.

string

Shared event name.

…unknown[]

Arguments delivered to matching handlers owned by the destination.

Promise<void>

Promise rejected when one or more destination handlers fail.


listenerCount(eventName): number

Defined in: client/api.d.ts:2641

Counts persistent and one-shot shared handlers across resources.

string

Shared event name to inspect.

number

Number of matching handlers.


off<K>(eventName, handler): void

Defined in: client/api.d.ts:2595

Removes a matching handler owned by the calling resource.

K extends keyof EventMap

K

Case-sensitive event name.

(…args) => unknown

Resource-owned callback invoked with the emitted arguments.

void

off(eventName, handler): void

Defined in: client/api.d.ts:2602

Removes a matching handler owned by the calling resource.

string

Case-sensitive event name.

EventHandler

Resource-owned callback invoked with the emitted arguments.

void


on<K>(eventName, handler): Unsubscribe

Defined in: client/api.d.ts:2566

Registers a persistent handler in the shared event namespace.

K extends keyof EventMap

K

Case-sensitive event name.

(…args) => unknown

Resource-owned callback invoked with the emitted arguments.

Unsubscribe

Function that removes this exact subscription.

on(eventName, handler): Unsubscribe

Defined in: client/api.d.ts:2574

Registers a persistent handler in the shared event namespace.

string

Case-sensitive event name.

EventHandler

Resource-owned callback invoked with the emitted arguments.

Unsubscribe

Function that removes this exact subscription.


once<K>(eventName, handler): void

Defined in: client/api.d.ts:2581

Registers a handler that is removed before its first invocation.

K extends keyof EventMap

K

Case-sensitive event name.

(…args) => unknown

Resource-owned callback invoked with the emitted arguments.

void

once(eventName, handler): void

Defined in: client/api.d.ts:2588

Registers a handler that is removed before its first invocation.

string

Case-sensitive event name.

EventHandler

Resource-owned callback invoked with the emitted arguments.

void


onLocal(eventName, handler): void

Defined in: client/api.d.ts:2626

Registers a handler in the calling resource’s private local-event namespace.

string

Case-sensitive event name.

EventHandler

Resource-owned callback invoked with the emitted arguments.

void