ComfyUI Node

FL JavaScript

FL_JS — run custom JavaScript on ComfyUI workflow events (in the browser)

By filliptm·Created 3 years ago·Updated a day ago· 630
FL JavaScript
      event
      javascript

      FL_JS lets you run your own JavaScript when a ComfyUI workflow event fires - when a run gets queued, when execution starts, when it finishes, when it errors, and so on. Pick the event, paste in some JS, and your code runs client-side at that moment. It's a hook into ComfyUI's frontend, for people who want to script little browser-side behaviors around their generations.

      Let's clear up the obvious confusion first, because the name invites it: this is browser JavaScript, not server-side compute. It doesn't run Python, it doesn't process your images, it isn't a way to inject logic into the generation itself. It runs in the ComfyUI web page, in response to the frontend's own event bus. So the natural use cases are things the browser can do: pop a desktop notification when a long render finishes, play a sound on completion, log timing to the console, tweak the page, trigger some other browser-side action.

      How it works

      ComfyUI's frontend emits events throughout a run's lifecycle. FL_JS registers your code against the event you choose, and when that event fires in your browser session, your JavaScript executes. It's a side-effect node - it doesn't transform data or produce an output, it just does something at the right moment.

      The inputs and outputs

      • event - which frontend event triggers your code. The list covers the run lifecycle: before_queued, after_queued, status, progress, executing, executed, execution_start, execution_success, execution_error, execution_cached, b_preview (and None to disable).
      • javascript (multiline) - the code to run when that event fires.

      There are no outputs - it doesn't feed anything downstream. It exists purely for the side effect.

      How to install it

      Part of filliptm's Fill-Nodes pack. ComfyUI Manager → search ComfyUI_Fill-Nodes → Install → restart, or:

      cd ComfyUI/custom_nodes
      git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
      pip install -r ComfyUI_Fill-Nodes/requirements.txt
      

      Nothing extra to install - the browser is the runtime.

      Common issues & troubleshooting

      Nothing happens on a headless or API run. This is the big one. FL_JS runs in a browser tab. If your workflow executes without an open ComfyUI frontend - a scheduled job, an API call, a hosted/serverless run - there's no browser to execute the JavaScript, so the node effectively does nothing. It only works when you're watching the workflow run in a browser.

      My code errored silently. JavaScript errors surface in the browser's developer console (F12), not in the ComfyUI server log. If your snippet isn't doing what you expect, open devtools and look there - that's where client-side errors live.

      Notifications/sound don't fire. Browser APIs have their own gates: desktop notifications need permission granted for the site, and audio autoplay is often blocked until you've interacted with the page. Those are browser rules, not the node's doing.

      A word on safety. It runs arbitrary JavaScript in your session, so only paste code you understand or trust. This is a power-user convenience, not something to run from a random shared workflow without reading it first - the same caution you'd apply to any code that executes in your browser.

      Category🏵️Fill Nodes/Utility

      Inputs (2)

      NameTypeDefaultDescription
      eventCOMBO12 options: None, before_queued, after_queued, status, progress, executing, +6
      javascriptSTRING

      Outputs (0)

      No outputs