EmitEvent
Since 0.6
A behavior called events.emit.
Signature
export interface EmitEvent {
type: "emit"
frame: number
name: string
data: unknown
by: string | null
}
Import: import type { EmitEvent } from "@argus/api"
Members
| Member | Signature | Description |
|---|---|---|
type | type: "emit" | |
frame | frame: number | |
name | name: string | |
data | data: unknown | |
by | by: string | null |
Example
The tested fixture fixtures/app/agent.ts.
import type { Behavior } from "@argus/api"
// Sends a nav agent to `props.target` once, then reports arrival through ctx.state so the
// test can read it without polling the crowd directly.
export default {
init(ctx) {
ctx.state.arrived = false
ctx.nav?.goTo(ctx.props.target as [number, number, number])
},
update(ctx) {
if (ctx.nav?.arrived) ctx.state.arrived = true
},
} satisfies Behavior