Make set node error an alert again, but throttled

This commit is contained in:
kijai 2023-12-16 00:19:26 +02:00
parent 004c4120e8
commit 2acf45063c

View File

@ -25,7 +25,15 @@ function setColorAndBgColor(type) {
// Handle the default case if needed
}
}
let isAlertShown = false;
function showAlertWithThrottle(message, delay) {
if (!isAlertShown) {
isAlertShown = true;
alert(message);
setTimeout(() => isAlertShown = false, delay);
}
}
app.registerExtension({
name: "SetNode",
registerCustomNodes() {
@ -322,7 +330,7 @@ app.registerExtension({
return link;
} else {
const errorMessage = "No SetNode found for " + this.widgets[0].value + "(" + this.type + ")";
console.log(errorMessage);
showAlertWithThrottle(errorMessage, 5000);
throw new Error(errorMessage);
}
}