Spaces:
Configuration error
Configuration error
import { app } from "../../../../scripts/app.js"; | |
class HUD { | |
constructor() { | |
this.current_node_id = undefined; | |
this.class_of_current_node = null; | |
this.current_node_is_chooser = false; | |
} | |
update() { | |
if (app.runningNodeId==this.current_node_id) return false; | |
this.current_node_id = app.runningNodeId; | |
if (this.current_node_id) { | |
this.class_of_current_node = app.graph?._nodes_by_id[app.runningNodeId.toString()]?.comfyClass; | |
this.current_node_is_chooser = this.class_of_current_node === "easy imageChooser" | |
} else { | |
this.class_of_current_node = undefined; | |
this.current_node_is_chooser = false; | |
} | |
return true; | |
} | |
} | |
const hud = new HUD(); | |
class FlowState { | |
constructor(){} | |
static idle() { | |
return (!app.runningNodeId); | |
} | |
static paused() { | |
return true; | |
} | |
static paused_here(node_id) { | |
return (FlowState.paused() && FlowState.here(node_id)) | |
} | |
static running() { | |
return (!FlowState.idle()); | |
} | |
static here(node_id) { | |
return (app.runningNodeId==node_id); | |
} | |
static state() { | |
if (FlowState.paused()) return "Paused"; | |
if (FlowState.running()) return "Running"; | |
return "Idle"; | |
} | |
static cancelling = false; | |
} | |
export { hud, FlowState} |