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, delivered once to each system and once
to 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<
Delivery,Scope>(name,schema,options):EventHandle<NoRecord,Delivery,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, delivered once to each system and once
to 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 |
|---|---|
Delivery extends EventDelivery |
Reliable |
Scope extends EventScope |
Entity |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
schema |
undefined |
options |
Pick<EventOptions<NoRecord, Delivery, Scope>, "delivery" | "scope"> |
Returns
Section titled “Returns”EventHandle<NoRecord, Delivery, Scope>
Call Signature
Section titled “Call Signature”defineEvent<
Schema,Delivery,Scope>(name,schema, …options):EventHandle<RecordOf<Schema>,Delivery,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, delivered once to each system and once
to 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 |
- |
Delivery extends EventDelivery |
Reliable |
Scope extends EventScope |
Entity |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
schema |
Schema |
…options |
RequiredWhereEntities<RecordOf<Schema>, EventOptions<RecordOf<Schema>, Delivery, Scope>> |
Returns
Section titled “Returns”EventHandle<RecordOf<Schema>, Delivery, Scope>