File size: 916 Bytes
8866644
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { api } from "../../../../scripts/api.js";
import { FlowState } from "./state.js";

function send_message_from_pausing_node(message) {
    const id = app.runningNodeId;
    send_message(id, message);
}

function send_message(id, message) {
    const body = new FormData();
    body.append('message',message);
    body.append('id', id);
    api.fetchApi("/easyuse/image_chooser_message", { method: "POST", body, });
}

function send_cancel() {
    send_message(-1,'__cancel__');
    FlowState.cancelling = true;
    api.interrupt();
    FlowState.cancelling = false;
}

var skip_next = 0;
function skip_next_restart_message() { skip_next += 1; }
function send_onstart() {
    if (skip_next>0) {
        skip_next -= 1;
        return false;
    }
    send_message(-1,'__start__');
    return true;
}

export { send_message_from_pausing_node, send_cancel, send_message, send_onstart, skip_next_restart_message }