defineEvent
Call Signature
Section titled “Call Signature”defineEvent(
name):EventHandle<NoRecord,Reliable,Entity>
Makes an event under name, which the log, the dump, the devtools and a
room’s stream know it by: defineEvent("damaged", { amount: 0, at: new Vector3() }). The record is its fields’ defaults, or a function that
makes them; with none, or one with no field, the event carries no
record. Each emit is one event, read once by each system and heard once
by each view that listens, in the order emitted. Called once, at module
scope, in a module the room and the page both import.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
Returns
Section titled “Returns”EventHandle<NoRecord, Reliable, Entity>
Call Signature
Section titled “Call Signature”defineEvent<
Replication,Scope>(name,schema,options):EventHandle<NoRecord,Replication,Scope>
Makes an event under name, which the log, the dump, the devtools and a
room’s stream know it by: defineEvent("damaged", { amount: 0, at: new Vector3() }). The record is its fields’ defaults, or a function that
makes them; with none, or one with no field, the event carries no
record. Each emit is one event, read once by each system and heard once
by each view that listens, in the order emitted. Called once, at module
scope, in a module the room and the page both import.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Replication extends EventReplication |
Reliable |
Scope extends EventScope |
Entity |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
schema |
undefined |
options |
Pick<EventOptions<NoRecord, Replication, Scope>, "replication" | "scope"> |
Returns
Section titled “Returns”EventHandle<NoRecord, Replication, Scope>
Call Signature
Section titled “Call Signature”defineEvent<
Schema,Replication,Scope>(name,schema, …options):EventHandle<RecordOf<Schema>,Replication,Scope>
Makes an event under name, which the log, the dump, the devtools and a
room’s stream know it by: defineEvent("damaged", { amount: 0, at: new Vector3() }). The record is its fields’ defaults, or a function that
makes them; with none, or one with no field, the event carries no
record. Each emit is one event, read once by each system and heard once
by each view that listens, in the order emitted. Called once, at module
scope, in a module the room and the page both import.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Schema extends object |
- |
Replication extends EventReplication |
Reliable |
Scope extends EventScope |
Entity |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
schema |
Schema |
…options |
RequiredWhereEntities<RecordOf<Schema>, EventOptions<RecordOf<Schema>, Replication, Scope>> |
Returns
Section titled “Returns”EventHandle<RecordOf<Schema>, Replication, Scope>