ComfyUI/web/extensions/core/comboBoolMigration.js
Lt.Dr.Data f91a3c7597 rename
2023-08-01 16:52:04 +09:00

22 lines
469 B
JavaScript

import { ComfyApp, app } from "../../scripts/app.js";
app.registerExtension({
name: "Comfy.comboBoolMigration",
nodeCreated(node, app) {
for(let i in node.widgets) {
let widget = node.widgets[i];
if(widget.type == "toggle") {
Object.defineProperty(widget, "value", {
set: (value) => {
delete widget.value;
widget.value = value == true || value == widget.options.on;
},
get: () => { return false; }
});
}
}
}
});