* Triggers the node code execution, place a boolean/counter to mark the node as being executed
(param?: unknown, options?: { action_call?: any })
| 1260 | * Triggers the node code execution, place a boolean/counter to mark the node as being executed |
| 1261 | */ |
| 1262 | doExecute(param?: unknown, options?: { action_call?: any }): void { |
| 1263 | options = options || {} |
| 1264 | if (this.onExecute) { |
| 1265 | // enable this to give the event an ID |
| 1266 | options.action_call ||= `${this.id}_exec_${Math.floor(Math.random() * 9999)}` |
| 1267 | if (!this.graph) throw new NullGraphError() |
| 1268 | |
| 1269 | // @ts-expect-error Technically it works when id is a string. Array gets props. |
| 1270 | this.graph.nodes_executing[this.id] = true |
| 1271 | this.onExecute(param, options) |
| 1272 | // @ts-expect-error deprecated |
| 1273 | this.graph.nodes_executing[this.id] = false |
| 1274 | |
| 1275 | // save execution/action ref |
| 1276 | this.exec_version = this.graph.iteration |
| 1277 | if (options?.action_call) { |
| 1278 | this.action_call = options.action_call |
| 1279 | // @ts-expect-error deprecated |
| 1280 | this.graph.nodes_executedAction[this.id] = options.action_call |
| 1281 | } |
| 1282 | } |
| 1283 | // the nFrames it will be used (-- each step), means "how old" is the event |
| 1284 | this.execute_triggered = 2 |
| 1285 | this.onAfterExecuteNode?.(param, options) |
| 1286 | } |
| 1287 | |
| 1288 | /** |
| 1289 | * Triggers an action, wrapped by logics to control execution flow |
no test coverage detected