MCPcopy Create free account
hub / github.com/Comfy-Org/litegraph.js / trigger

Method trigger

src/LGraphNode.ts:1325–1347  ·  view source on GitHub ↗

* Triggers an event in this node, this will trigger any output with the same name * @param action name ( "on_play", ... ) if action is equivalent to false then the event is send to all

(
    action: string,
    param: unknown,
    options: { action_call?: any },
  )

Source from the content-addressed store, hash-verified

1323 * @param action name ( "on_play", ... ) if action is equivalent to false then the event is send to all
1324 */
1325 trigger(
1326 action: string,
1327 param: unknown,
1328 options: { action_call?: any },
1329 ): void {
1330 const { outputs } = this
1331 if (!outputs || !outputs.length) {
1332 return
1333 }
1334
1335 if (this.graph) this.graph._last_trigger_time = LiteGraph.getTime()
1336
1337 for (const [i, output] of outputs.entries()) {
1338 if (
1339 !output ||
1340 output.type !== LiteGraph.EVENT ||
1341 (action && output.name != action)
1342 ) {
1343 continue
1344 }
1345 this.triggerSlot(i, param, null, options)
1346 }
1347 }
1348
1349 /**
1350 * Triggers a slot event in this node: cycle output slots and launch execute/action on connected nodes

Callers

nothing calls this directly

Calls 2

triggerSlotMethod · 0.95
getTimeMethod · 0.45

Tested by

no test coverage detected