diff --git a/py/system_notification.py b/py/system_notification.py index e9a29c9..d5a52c1 100644 --- a/py/system_notification.py +++ b/py/system_notification.py @@ -28,8 +28,8 @@ class SystemNotification: def IS_CHANGED(self, **kwargs): return float("NaN") - def nop(self, any, **kwargs): - return {"ui": {"a": []}, "result": (any,)} + def nop(self, any, message, mode): + return {"ui": {"message": message, "mode": mode}, "result": (any,)} NODE_CLASS_MAPPINGS = { diff --git a/web/js/systemNotification.js b/web/js/systemNotification.js index 2cc93ba..803b8c9 100644 --- a/web/js/systemNotification.js +++ b/web/js/systemNotification.js @@ -22,12 +22,10 @@ app.registerExtension({ async beforeRegisterNodeDef(nodeType, nodeData, app) { if (nodeData.name === "SystemNotification|pysssss") { const onExecuted = nodeType.prototype.onExecuted; - nodeType.prototype.onExecuted = async function () { + nodeType.prototype.onExecuted = async function ({ message, mode }) { onExecuted?.apply(this, arguments); - const mode = this.widgets.find((w) => w.name === "mode"); - const message = this.widgets.find((w) => w.name === "message"); - if (mode.value === "on empty queue") { + if (mode === "on empty queue") { if (app.ui.lastQueueSize !== 0) { await new Promise((r) => setTimeout(r, 500)); } @@ -36,7 +34,7 @@ app.registerExtension({ } } if (!notificationSetup()) return; - const notification = new Notification("ComfyUI", { body: message.value ?? "Your notification has triggered." }); + const notification = new Notification("ComfyUI", { body: message ?? "Your notification has triggered." }); }; const onNodeCreated = nodeType.prototype.onNodeCreated;