Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Add a few comments
Browse files Browse the repository at this point in the history
  • Loading branch information
parzival418 committed Oct 22, 2021
1 parent 708b323 commit 2bad9c1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/src/plugins/taskPlugin/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ export class Task {
fromNode,
} = options

// garbage means that the nodes output value will be reset after it is all done.
if (needReset) garbage.push(this)

// This would be a great place to run an animation showing the signal flow.
// Just needto figure out how to change the folow of the connection attached to a socket on the fly.
// And animations should follow the flow of the data, not the main IO paths

// Only run the worker if the outputData isnt already populated.
if (!this.outputData) {
const inputs = {} as Record<string, unknown[]>

Expand Down Expand Up @@ -137,15 +139,22 @@ export class Task {
})
)

// socket info is used internally in the worker if we need to know about where signals come from.
// this is mainly used currently by the module plugin to know where the run signal should go to.
const socketInfo = {
target: fromSocket ? this.getInputFromConnection(fromSocket) : null,
}

// the main output data of the task, which is gathered up when the next node gets this nodes value
this.outputData = await this.worker(this, inputs, data, socketInfo)

// an onRun option in case a task whats to do something when the task is run.
if (this.component.task.onRun)
this.component.task.onRun(this.node, this, data, socketInfo)

// this is what propagates the the run command to the next nodes in the chain
// this makes use of the 'next' nodes. It also will filter out any connectios which the task has closed.
// it is this functionality that lets us control which direction the run signal flows.
if (propagate)
await Promise.all(
this.next
Expand Down

0 comments on commit 2bad9c1

Please sign in to comment.