Files
KLL535-ComfyUI_SimpleButcher/js/SimpleLoraLoader.js
T
2025-01-26 23:57:09 +03:00

18 lines
826 B
JavaScript

import { app } from "/scripts/app.js";
app.registerExtension({
name: "Simple Lora Loader",
async beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData.name === "Simple Lora Loader") {
const originalOnNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function() {
if (originalOnNodeCreated) { originalOnNodeCreated.call(this); }
let counter = 1;
const count = this.widgets.find((w) => w.name === "count");
count.type = "converted-widget"; // hidden
count.serializeValue = () => { return counter++; }
this.addWidget("button","Update LoRA dictionary",null,() => { counter = 0; },{ width: 150 });
};
}
},
});