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
35
36
37
38
39
use crate::interface::{CrashReport, CrashReporterStartOptions};
use js_sys::JsString;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(module = "electron")]
extern {
    #[wasm_bindgen]
    pub type CrashReporter;

    #[wasm_bindgen(js_name = "crashReporter")]
    pub static crash_reporter: CrashReporter;

    #[wasm_bindgen(method, js_name = "addExtraParameter")]
    pub fn add_extra_parameter(this: &CrashReporter, key: &str, value: &str);

    #[wasm_bindgen(method, js_name = "getCrashesDirectory")]
    pub fn get_crashes_directory(this: &CrashReporter) -> JsString;

    #[wasm_bindgen(method, js_name = "getLastCrashReport")]
    pub fn get_last_crash_report(this: &CrashReporter) -> CrashReport;

    #[wasm_bindgen(method, js_name = "getParameters")]
    pub fn get_parameters(this: &CrashReporter);

    #[wasm_bindgen(method, js_name = "getUploadedReports")]
    pub fn get_uploaded_reports(this: &CrashReporter) -> Box<[JsValue]>;

    #[wasm_bindgen(method, js_name = "getUploadToServer")]
    pub fn get_upload_to_server(this: &CrashReporter) -> bool;

    #[wasm_bindgen(method, js_name = "removeExtraParameter")]
    pub fn remove_extra_parameter(this: &CrashReporter, key: &str);

    #[wasm_bindgen(method, js_name = "setUploadToServer")]
    pub fn setUploadToServer(this: &CrashReporter, upload_to_server: bool);

    #[wasm_bindgen(method)]
    pub fn start(this: &CrashReporter, options: CrashReporterStartOptions);
}