Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

emitEvent

emitEvent<Record, Replication, Scope>(source, event, …rest): void

Emits event: one event, read once by each system and heard once by each view that listens, in the order emitted, and two emits are never merged. The record is copied as it is emitted, each field left out at its default. An outcome takes an authority: the room’s step, inside if (step.authoritative) or in a system with no runsOn; the authority useAuthorityEffect hands a logic component; or findAuthority(writer, entity) for an entity only this page holds. A local event takes the world that draws, outside any step: emitEvent(step, DamagedEvent, { amount: 12 }, { entity: target }).

Type Parameter
Record
Replication extends EventReplication
Scope extends EventScope
Parameter Type
source EmitSource<Replication, Scope>
event EventHandle<Record, Replication, Scope>
…rest EmitArguments<Record, Replication, Scope>

void