custom-nodes/js/javascript_hooks #634
Replies: 2 comments
-
|
To get a value passed to the node after execution use the following:
def execute(self, inp0):
result = inp0.reverse()
return { "ui": { "input": inp0 }, "result": result }
async nodeCreated(node)
{
if (node.comfyClass === "MyNode")
{
node.onExecuted = function (ui)
{
console.log(ui.input)
}
}
}note that if you use
RETURN_NAMES = ("out0",)
RETURN_TYPES = ("STRING",)
OUTPUT_IS_LIST = (True,)
def execute(self, inp0):
result = [v.reverse() for v in inp0]
return { "ui": { "input": [inp0] }, "result": ] } |
Beta Was this translation helpful? Give feedback.
-
|
This article is about hooks in Javascript context. If you are here because you're looking for hooks in Python context, note the following:
As far as I see it, it is not possible to provide background services with custom nodes, using only the official interfaces. Of course you can always hack something up. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
custom-nodes/js/javascript_hooks
https://docs.comfy.org/custom-nodes/js/javascript_hooks
Beta Was this translation helpful? Give feedback.
All reactions