This commit is contained in:
justumen
2024-09-13 07:49:15 +02:00
parent d0b40589ea
commit 0cdec9184c
9 changed files with 119 additions and 6 deletions

37
web/js/pauseresume.js Normal file
View File

@@ -0,0 +1,37 @@
import { app } from "../../../scripts/app.js";
app.registerExtension({
name: "Bjornulf.PauseResume",
async nodeCreated(node) {
if (node.comfyClass === "Bjornulf_PauseResume") {
const resumeButton = node.addWidget("button", "Resume", "Resume", () => {
fetch('/bjornulf_resume', { method: 'GET' })
.then(response => response.text())
.then(data => {
console.log('Resume response:', data);
// You can update the UI here if needed
})
.catch(error => console.error('Error:', error));
});
const stopButton = node.addWidget("button", "Stop", "Stop", () => {
fetch('/bjornulf_stop', { method: 'GET' })
.then(response => response.text())
.then(data => {
console.log('Stop response:', data);
// You can update the UI here if needed
})
.catch(error => console.error('Error:', error));
});
}
}
});
// BASIC BUTTON
// app.registerExtension({
// name: "Bjornulf.PauseResume",
// async nodeCreated(node) {
// if (node.comfyClass === "Bjornulf_PauseResume") {
// node.addWidget("button","Resume","Resume", (...args) => { console.log("lol"); } )
// }
// }
// });