* Triggers an action, wrapped by logics to control execution flow * @param action name
(
action: string,
param: unknown,
options: { action_call?: string },
)
| 1290 | * @param action name |
| 1291 | */ |
| 1292 | actionDo( |
| 1293 | action: string, |
| 1294 | param: unknown, |
| 1295 | options: { action_call?: string }, |
| 1296 | ): void { |
| 1297 | options = options || {} |
| 1298 | if (this.onAction) { |
| 1299 | // enable this to give the event an ID |
| 1300 | options.action_call ||= `${this.id}_${action || "action"}_${Math.floor(Math.random() * 9999)}` |
| 1301 | if (!this.graph) throw new NullGraphError() |
| 1302 | |
| 1303 | // @ts-expect-error deprecated |
| 1304 | this.graph.nodes_actioning[this.id] = action || "actioning" |
| 1305 | this.onAction(action, param, options) |
| 1306 | // @ts-expect-error deprecated |
| 1307 | this.graph.nodes_actioning[this.id] = false |
| 1308 | |
| 1309 | // save execution/action ref |
| 1310 | if (options?.action_call) { |
| 1311 | this.action_call = options.action_call |
| 1312 | // @ts-expect-error deprecated |
| 1313 | this.graph.nodes_executedAction[this.id] = options.action_call |
| 1314 | } |
| 1315 | } |
| 1316 | // the nFrames it will be used (-- each step), means "how old" is the event |
| 1317 | this.action_triggered = 2 |
| 1318 | this.onAfterExecuteNode?.(param, options) |
| 1319 | } |
| 1320 | |
| 1321 | /** |
| 1322 | * Triggers an event in this node, this will trigger any output with the same name |
no test coverage detected