Code style changes.

This commit is contained in:
Royce Schultz
2024-05-16 15:34:22 -06:00
parent 7e9a200923
commit 9697bba011
2 changed files with 26 additions and 26 deletions
+11 -11
View File
@@ -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)
};
}
}
},
});
})
+15 -15
View File
@@ -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()
}
}
},
});
})