Skip to main content

Emitted events

:::info Copied from the repository This page is app.gap.Tsum/EVENTS.md, copied in by the site's sync step. Regenerate it there with npm run events:docs; edits here are lost at the next sync. :::

What this script broadcasts to tooling following a run, and what each event carries. The host defines none of it: emitEvent(name, data) hands a line to whichever consumers are attached, adding only a sequence number, a UTC timestamp and the script id. The transport, the two sockets and the wire format are the host's document -- ../general-automation-app/docs/EVENTS.md.

Names are declared once, in src/scriptEvents.ts, and reached through ts.emit(), which is silent on a host too old to have emitEvent.

12 event(s) from 12 call site(s).

eventemitted frompayload
task.startsrc/taskController.ts:93task
round.oversrc/play.ts:412id, round, seconds
round.startsrc/play.ts:592id, round, myTsum, myTsumName, skill, build, settings
round.endsrc/play.ts:964id, round, myTsum, myTsumName, skill, build, seconds, score, baseCoins, finalCoins, medals, settings
workflow.endsrc/gapWorkflow.ts:589id, rev, status, reason, loop, index
workflow.startsrc/gapWorkflow.ts:644id, rev, name, total
workflow.nodesrc/gapWorkflow.ts:686id, loop, index, nodeId, node
workflow.loopsrc/gapWorkflow.ts:700id, loop
workflow.nodeFailedsrc/gapWorkflow.ts:745id, loop, index, nodeId, node, error, tries
run.startedsrc/index.ts:86version, skill, locale
run.stoppedsrc/index.ts:805rounds

The events​

task.start​

Emit.Task.Started — The loop has switched to another job (TaskName, src/runPlan.ts, or a Now sweep's name): sending hearts, the mailbox, playing rounds. Emitted only when the job differs from the last one, so back-to-back rounds say it once.

fieldtype
taskstring

Emitted from:

  • src/taskController.ts:93 — emitScriptEvent(Emit.Task.Started, …)

round.over​

Emit.Round.Over — The board is finished and the score tally is beginning.

fieldtype
idstring
roundnumber
secondsnumber

Emitted from:

  • src/play.ts:412 — this.emit(Emit.Round.Over, …)

round.start​

Emit.Round.Start — The pre-round screen is up with the bonus items set, and Start is about to be tapped. The signal to start recording -- emitted here rather than on the board so a recording opens on the items the round is being played with; the board follows a few seconds later. id is the round's own, repeated by every other round.* event of that round -- which is how a consumer several emulators dial into tells one round's events from another's, where round counts a single device's rounds and starts at 1 on each. It is also the CSV row's id. settings is what the round is being played under: the gameplay settings the stats CSV records as columns, as the settings object holds them.

fieldtype
idstring
roundnumber
myTsumstring
myTsumNamestring
skillstring
buildGameBuild
settingsPartial<Settings> | undefined

Emitted from:

  • src/play.ts:592 — this.emit(Emit.Round.Start, …)

round.end​

Emit.Round.End — The tally is done and the figures have been read. The signal to stop recording, and the only event carrying the round's numbers. settings repeats what round.start said, so this one event stands on its own.

fieldtype
idstring
roundnumber
myTsumstring
myTsumNamestring
skillstring
buildGameBuild
secondsnumber
scorenumber | null
baseCoinsnumber | null
finalCoinsnumber | null
medalsnumber | null
settingsPartial<Settings> | undefined

Emitted from:

  • src/play.ts:964 — this.emit(Emit.Round.End, …)

workflow.end​

Emit.Workflow.End — The workflow is over: status is ended, failed or terminated, reason why.

fieldtype
idstring
revnumber
statusstring
reasonstring
loopnumber
indexnumber

Emitted from:

  • src/gapWorkflow.ts:589 — gapWorkflowHooksOf().emit('workflow.end', …)

workflow.start​

Emit.Workflow.Start — A workflow passed its check and its first node is next.

fieldtype
idstring
revnumber
namestring
totalnumber

Emitted from:

  • src/gapWorkflow.ts:644 — gapWorkflowHooksOf().emit('workflow.start', …)

workflow.node​

Emit.Workflow.Node — A node's first call in this pass (not repeated for again, wait or a retry).

fieldtype
idstring
loopnumber
indexnumber
nodeIdstring
nodestring

Emitted from:

  • src/gapWorkflow.ts:686 — gapWorkflowHooksOf().emit('workflow.node', …)

workflow.loop​

Emit.Workflow.Loop — Pass loop (2 or more) begins at the first node.

fieldtype
idstring
loopnumber

Emitted from:

  • src/gapWorkflow.ts:700 — gapWorkflowHooksOf().emit('workflow.loop', …)

workflow.nodeFailed​

Emit.Workflow.NodeFailed — A node failed its last try and was skipped.

fieldtype
idstring
loopnumber
indexnumber
nodeIdstring
nodestring
errorstring
triesnumber

Emitted from:

  • src/gapWorkflow.ts:745 — gapWorkflowHooksOf().emit('workflow.nodeFailed', …)

run.started​

Emit.Run.Started — A run has been asked for and its world is about to be built.

fieldtype
versionstring
skillstring
localeLocale | undefined

Emitted from:

  • src/index.ts:86 — emitScriptEvent(Emit.Run.Started, …)

run.stopped​

Emit.Run.Stopped — The run's world has been dismantled; nothing is playing.

fieldtype
roundsnumber

Emitted from:

  • src/index.ts:805 — emitScriptEvent(Emit.Run.Stopped, …)