mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
22 lines
529 B
TypeScript
22 lines
529 B
TypeScript
import { api } from '../../api'
|
|
import { ComfyButton } from '../components/button'
|
|
|
|
export function getInteruptButton(visibility: string) {
|
|
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
|
|
}
|