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
//!
//! Handling of WASM panic hook that allows activation of console-based panic hook
//! as well as a browser-based panic hook.  (the browser-based panic hook activates a full-screen debug
//! information output in case of a panic - useful on mobile devices or where
//! the user otherwise has no access to console/developer tools)
//!

use wasm_bindgen::prelude::*;
use workflow_panic_hook::{set_once, show_logs as show_wasm_logs, Type};

/// Initialize panic hook in console mode
#[wasm_bindgen]
pub fn init_console_panic_hook() {
    set_once(Type::Console);
}

/// Initialize panic hook in browser mode
#[wasm_bindgen]
pub fn init_popup_panic_hook() {
    set_once(Type::Popup);
}

/// Present panic logs to the user
#[wasm_bindgen]
pub fn show_panic_hook_logs() {
    show_wasm_logs();
}