1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Perform operations on the current process.

/// Exits immediately with the given `exit_code`.
#[inline(always)]
pub async fn exit(exit_code: i32) -> ! {
    inner::exit(exit_code).await;
    unreachable!()
}

/// Exits the current instance of the app then relaunches it.
#[inline(always)]
pub fn relaunch() {
    inner::relaunch();
}

mod inner {
    use wasm_bindgen::prelude::*;

    #[wasm_bindgen(module = "/src/process.js")]
    extern "C" {
        pub async fn exit(exitCode: i32);
        pub fn relaunch();
    }
}