diff --git a/js/display_int.js b/js/display_int.js index 9c0be2e..22562e6 100644 --- a/js/display_int.js +++ b/js/display_int.js @@ -5,14 +5,13 @@ app.registerExtension({ name: "rgthree.DisplayInt", async beforeRegisterNodeDef(nodeType, nodeData, app) { if (nodeData.name === "Display Int (rgthree)") { - let showValueWidget; nodeType.title_mode = LiteGraph.NO_TITLE; const onNodeCreated = nodeType.prototype.onNodeCreated; nodeType.prototype.onNodeCreated = function () { onNodeCreated ? onNodeCreated.apply(this, []) : undefined; - showValueWidget = ComfyWidgets["STRING"](this, "output", ["STRING", { multiline: true }], app).widget; - showValueWidget.inputEl.readOnly = true; - showValueWidget.serializeValue = async (node, index) => { + this.showValueWidget = ComfyWidgets["STRING"](this, "output", ["STRING", { multiline: true }], app).widget; + this.showValueWidget.inputEl.readOnly = true; + this.showValueWidget.serializeValue = async (node, index) => { node.widgets_values[index] = ''; return ''; }; @@ -20,8 +19,9 @@ app.registerExtension({ addConnectionLayoutSupport(nodeType, app, [['Left'], ['Right']]); const onExecuted = nodeType.prototype.onExecuted; nodeType.prototype.onExecuted = function (message) { + var _a; onExecuted === null || onExecuted === void 0 ? void 0 : onExecuted.apply(this, [message]); - showValueWidget.value = message.text[0]; + (_a = this.showValueWidget) === null || _a === void 0 ? void 0 : _a.value = message.text[0]; }; } }, diff --git a/ts/display_int.ts b/ts/display_int.ts index ee8e4be..f994ff2 100644 --- a/ts/display_int.ts +++ b/ts/display_int.ts @@ -14,7 +14,6 @@ app.registerExtension({ name: "rgthree.DisplayInt", async beforeRegisterNodeDef(nodeType: typeof LGraphNode, nodeData: ComfyObjectInfo, app: ComfyApp) { if (nodeData.name === "Display Int (rgthree)") { - let showValueWidget!: ComfyWidget; (nodeType as any).title_mode = LiteGraph.NO_TITLE; @@ -22,9 +21,9 @@ app.registerExtension({ nodeType.prototype.onNodeCreated = function () { onNodeCreated ? onNodeCreated.apply(this, []) : undefined; - showValueWidget = ComfyWidgets["STRING"](this, "output", ["STRING", { multiline: true }], app).widget; - showValueWidget.inputEl!.readOnly = true; - showValueWidget.serializeValue = async (node: SerializedLGraphNode, index: number) => { + (this as any).showValueWidget = ComfyWidgets["STRING"](this, "output", ["STRING", { multiline: true }], app).widget; + (this as any).showValueWidget.inputEl!.readOnly = true; + (this as any).showValueWidget.serializeValue = async (node: SerializedLGraphNode, index: number) => { // Since we need a round trip to get the value, the serizalized value means nothing, and // saving it to the metadata would just be confusing. So, we clear it here. node.widgets_values![index] = ''; @@ -37,7 +36,7 @@ app.registerExtension({ const onExecuted = nodeType.prototype.onExecuted; nodeType.prototype.onExecuted = function (message) { onExecuted?.apply(this, [message]); - showValueWidget.value = message.text[0]; + (this as any).showValueWidget?.value = message.text[0]; }; } },