Skip to content

Latest commit

 

History

History
53 lines (31 loc) · 1.3 KB

File metadata and controls

53 lines (31 loc) · 1.3 KB
source

Represents an event sent between TypeScript event listeners on the same client in Meta Horizon Worlds. These events support arbitrary data.

export declare class LocalEvent<TPayload extends LocalEventData = Record<string, never>> 

When sent between event listeners on the same client (locally), LocalEvent outperforms CodeBlockEvent because it doesn't use the legacy messaging system used by Code Block scripting.
For events sent over a network, you can use NetworkEvent.

Creates a local event with the specified name.

Signature

constructor(name?: string);

Parameters

name: string

(Optional) The name of the event.

Remarks

If a name is not provided, the event becomes unique and must be referenced by its object instance. This is useful if your event is used in an asset to avoid collision in a world.

The name of the event. If a name is not provided, a randomly generated name is assigned.

Signature

name: string;