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).
| event | emitted from | payload |
|---|---|---|
task.start | src/taskController.ts:93 | task |
round.over | src/play.ts:412 | id, round, seconds |
round.start | src/play.ts:592 | id, round, myTsum, myTsumName, skill, build, settings |
round.end | src/play.ts:964 | id, round, myTsum, myTsumName, skill, build, seconds, score, baseCoins, finalCoins, medals, settings |
workflow.end | src/gapWorkflow.ts:589 | id, rev, status, reason, loop, index |
workflow.start | src/gapWorkflow.ts:644 | id, rev, name, total |
workflow.node | src/gapWorkflow.ts:686 | id, loop, index, nodeId, node |
workflow.loop | src/gapWorkflow.ts:700 | id, loop |
workflow.nodeFailed | src/gapWorkflow.ts:745 | id, loop, index, nodeId, node, error, tries |
run.started | src/index.ts:86 | version, skill, locale |
run.stopped | src/index.ts:805 | rounds |
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.
| field | type |
|---|---|
task | string |
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.
| field | type |
|---|---|
id | string |
round | number |
seconds | number |
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.
| field | type |
|---|---|
id | string |
round | number |
myTsum | string |
myTsumName | string |
skill | string |
build | GameBuild |
settings | Partial<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.
| field | type |
|---|---|
id | string |
round | number |
myTsum | string |
myTsumName | string |
skill | string |
build | GameBuild |
seconds | number |
score | number | null |
baseCoins | number | null |
finalCoins | number | null |
medals | number | null |
settings | Partial<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.
| field | type |
|---|---|
id | string |
rev | number |
status | string |
reason | string |
loop | number |
index | number |
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.
| field | type |
|---|---|
id | string |
rev | number |
name | string |
total | number |
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).
| field | type |
|---|---|
id | string |
loop | number |
index | number |
nodeId | string |
node | string |
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.
| field | type |
|---|---|
id | string |
loop | number |
Emitted from:
src/gapWorkflow.ts:700—gapWorkflowHooksOf().emit('workflow.loop', …)
workflow.nodeFailed
Emit.Workflow.NodeFailed — A node failed its last try and was skipped.
| field | type |
|---|---|
id | string |
loop | number |
index | number |
nodeId | string |
node | string |
error | string |
tries | number |
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.
| field | type |
|---|---|
version | string |
skill | string |
locale | Locale | 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.
| field | type |
|---|---|
rounds | number |
Emitted from:
src/index.ts:805—emitScriptEvent(Emit.Run.Stopped, …)