Talos docs

StringsHandle

Since 0.6
Plain text

Reached in a behaviour as ctx.strings.

Signature

export interface StringsHandle {
  /** The string for `key`, or the literal `[[key]]` when the scene does not define it (the critic flags those). */
  get(key: string): string
  has(key: string): boolean
}

Import: import type { StringsHandle } from "@argus/api"

Members

MemberSignatureDescription
getget(key: string): stringThe string for key, or the literal [[key]] when the scene does not define it (the critic flags those).
hashas(key: string): boolean

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