From 9697bba011827824620070e407755299e17be024 Mon Sep 17 00:00:00 2001 From: Royce Schultz Date: Thu, 16 May 2024 15:34:22 -0600 Subject: [PATCH] Code style changes. --- web/play_sound.js | 22 +++++++++++----------- web/system_notification.js | 30 +++++++++++++++--------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/web/play_sound.js b/web/play_sound.js index 70d0199..d678d78 100644 --- a/web/play_sound.js +++ b/web/play_sound.js @@ -1,19 +1,19 @@ -import { app } from "../../../scripts/app.js"; -import { playSound, appQueueIsEmpty } from "./util.js"; +import { app } from '../../../scripts/app.js' +import { playSound, appQueueIsEmpty } from './util.js' app.registerExtension({ - name: "Notifications.PlaySound", + name: 'Notifications.PlaySound', async beforeRegisterNodeDef(nodeType, nodeData, app) { - if (nodeData.name === "Notif-PlaySound") { - const onExecuted = nodeType.prototype.onExecuted; + if (nodeData.name === 'Notif-PlaySound') { + const onExecuted = nodeType.prototype.onExecuted nodeType.prototype.onExecuted = async function () { - onExecuted?.apply(this, arguments); - if (this.widgets[0].value === "on empty queue") { - if (!await appQueueIsEmpty(app)) return; + onExecuted?.apply(this, arguments) + if (this.widgets[0].value === 'on empty queue') { + if (!await appQueueIsEmpty(app)) return } - let file = this.widgets[2].value; + let file = this.widgets[2].value playSound(file, this.widgets[1].value) - }; + } } }, -}); +}) diff --git a/web/system_notification.js b/web/system_notification.js index e801902..428a2ad 100644 --- a/web/system_notification.js +++ b/web/system_notification.js @@ -1,29 +1,29 @@ -import { app } from "../../../scripts/app.js"; +import { app } from '../../../scripts/app.js' import { notificationSetup, sendNotification, getNotificationTextFromArguments, appQueueIsEmpty, -} from "./util.js"; +} from './util.js' app.registerExtension({ - name: "Notifications.SystemNotification", + name: 'Notifications.SystemNotification', async beforeRegisterNodeDef(nodeType, nodeData, app) { - if (nodeData.name === "Notif-SystemNotification") { - const onExecuted = nodeType.prototype.onExecuted; + if (nodeData.name === 'Notif-SystemNotification') { + const onExecuted = nodeType.prototype.onExecuted nodeType.prototype.onExecuted = async function () { - onExecuted?.apply(this, arguments); - if (this.widgets[0].value === "on empty queue") { - if (!await appQueueIsEmpty(app)) return; + onExecuted?.apply(this, arguments) + if (this.widgets[0].value === 'on empty queue') { + if (!await appQueueIsEmpty(app)) return } - if (!notificationSetup()) return; + if (!notificationSetup()) return const notification_text = getNotificationTextFromArguments(arguments) - sendNotification("ComfyUI", notification_text) - }; + sendNotification('ComfyUI', notification_text) + } - const onNodeCreated = nodeType.prototype.onNodeCreated; + const onNodeCreated = nodeType.prototype.onNodeCreated nodeType.prototype.onNodeCreated = function () { - onNodeCreated?.apply(this, arguments); - notificationSetup(); + onNodeCreated?.apply(this, arguments) + notificationSetup() } } }, -}); +})