()
| 597 | } |
| 598 | |
| 599 | async function cancel() { |
| 600 | const _status: Status = { |
| 601 | stage: "complete", |
| 602 | queue: false, |
| 603 | time: new Date(), |
| 604 | }; |
| 605 | complete = _status; |
| 606 | fire_event({ |
| 607 | ..._status, |
| 608 | type: "status", |
| 609 | endpoint: _endpoint, |
| 610 | fn_index: fn_index, |
| 611 | }); |
| 612 | |
| 613 | if (websocket && websocket.readyState === 0) { |
| 614 | websocket.addEventListener("open", () => { |
| 615 | websocket.close(); |
| 616 | }); |
| 617 | } else { |
| 618 | websocket.close(); |
| 619 | } |
| 620 | |
| 621 | try { |
| 622 | await fetch_implementation( |
| 623 | `${http_protocol}//${host + config.path}/reset`, |
| 624 | { |
| 625 | headers: { "Content-Type": "application/json" }, |
| 626 | method: "POST", |
| 627 | body: JSON.stringify({ fn_index, session_hash }), |
| 628 | } |
| 629 | ); |
| 630 | } catch (e) { |
| 631 | console.warn( |
| 632 | "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable." |
| 633 | ); |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | function destroy() { |
| 638 | for (const event_type in listener_map) { |
nothing calls this directly
no test coverage detected