File size: 549 Bytes
e26a977
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// @ts-check

import { api } from "../../api.js";
import { ComfyButton } from "../components/button.js";

export function getInteruptButton(visibility) {
	const btn = new ComfyButton({
		icon: "close",
		tooltip: "Cancel current generation",
		enabled: false,
		action: () => {
			api.interrupt();
		},
		classList: ["comfyui-button", "comfyui-interrupt-button", visibility],
	});

	api.addEventListener("status", ({ detail }) => {
		const sz = detail?.exec_info?.queue_remaining;
		btn.enabled = sz > 0;
	});

	return btn;
}