electron_sys/interface/
process.rs

1use crate::interface::{BlinkMemoryInfo, CpuUsage, HeapStatistics, IoCounters, ProcessMemoryInfo, SystemMemoryInfo};
2use js_sys::JsString;
3use node_sys::Process as NodeProcess;
4use wasm_bindgen::prelude::*;
5
6#[wasm_bindgen]
7extern {
8    #[wasm_bindgen(extends = NodeProcess)]
9    #[derive(Clone, Debug)]
10    pub type Process;
11
12    //******************//
13    // Instance Methods //
14    //******************//
15
16    #[wasm_bindgen(method)]
17    pub fn crash(this: &Process);
18
19    #[wasm_bindgen(method, js_name = "getBlinkMemoryInfo")]
20    pub fn get_blink_memory_info(this: &Process) -> BlinkMemoryInfo;
21
22    #[wasm_bindgen(method, js_name = "getCPUUsage")]
23    pub fn get_cpu_usage(this: &Process) -> CpuUsage;
24
25    #[wasm_bindgen(method, js_name = "getCreationTime")]
26    pub fn get_creation_time(this: &Process) -> Option<u64>;
27
28    #[wasm_bindgen(method, js_name = "getHeapStatistics")]
29    pub fn get_heap_statistics(this: &Process) -> HeapStatistics;
30
31    #[wasm_bindgen(method, js_name = "getIOCounters")]
32    pub fn get_io_counters(this: &Process) -> IoCounters;
33
34    #[wasm_bindgen(method, js_name = "getProcessMemoryInfo")]
35    pub fn get_process_memory_info(this: &Process) -> ProcessMemoryInfo;
36
37    #[wasm_bindgen(method, js_name = "getSystemMemoryInfo")]
38    pub fn get_system_memory_info(this: &Process) -> SystemMemoryInfo;
39
40    #[wasm_bindgen(method, js_name = "getSystemVersion")]
41    pub fn get_system_version(this: &Process) -> JsString;
42
43    #[wasm_bindgen(method)]
44    pub fn hang(this: &Process);
45
46    #[wasm_bindgen(method, js_name = "setFdLimit")]
47    pub fn set_fd_limit(this: &Process, max_descriptors: u64);
48
49    #[wasm_bindgen(method, js_name = "takeHeapSnapshot")]
50    pub fn take_heap_snapshot(this: &Process, file_path: &str) -> bool;
51
52    //*********************//
53    // Instance Properties //
54    //*********************//
55
56    #[wasm_bindgen(method, getter)] // readonly
57    pub fn chrome(this: &Process) -> JsString;
58
59    #[wasm_bindgen(method, getter, js_name = "defaultApp")] // readonly
60    pub fn default_app(this: &Process) -> bool;
61
62    #[wasm_bindgen(method, getter)] // readonly
63    pub fn electron(this: &Process) -> JsString;
64
65    #[wasm_bindgen(method, getter, js_name = "enablePromiseApi")]
66    pub fn enable_promise_api(this: &Process) -> bool;
67
68    #[wasm_bindgen(method, setter, js_name = "enablePromiseApi")]
69    pub fn set_enable_promise_api(this: &Process, value: bool);
70
71    #[wasm_bindgen(method, getter, js_name = "isMainFrame")] // readonly
72    pub fn is_main_frame(this: &Process) -> bool;
73
74    #[wasm_bindgen(method, getter)] // readonly
75    pub fn mas(this: &Process) -> bool;
76
77    #[wasm_bindgen(method, getter, js_name = "noAsar")]
78    pub fn no_asar(this: &Process) -> bool;
79
80    #[wasm_bindgen(method, setter, js_name = "noAsar")]
81    pub fn set_no_asar(this: &Process, value: bool);
82
83    #[wasm_bindgen(method, getter, js_name = "noDeprecation")]
84    pub fn no_deprecation(this: &Process) -> bool;
85
86    #[wasm_bindgen(method, setter, js_name = "noDeprecation")]
87    pub fn set_no_deprecation(this: &Process, value: bool);
88
89    #[wasm_bindgen(method, getter, js_name = "resourcesPath")] // readonly
90    pub fn resources_path(this: &Process) -> JsString;
91
92    #[wasm_bindgen(method, getter)] // readonly
93    pub fn sandboxed(this: &Process) -> bool;
94
95    #[wasm_bindgen(method, getter, js_name = "throwDeprecation")]
96    pub fn throw_deprecation(this: &Process) -> bool;
97
98    #[wasm_bindgen(method, setter, js_name = "throwDeprecation")]
99    pub fn set_throw_deprecation(this: &Process, value: bool);
100
101    #[wasm_bindgen(method, getter, js_name = "traceDeprecation")]
102    pub fn trace_deprecation(this: &Process) -> bool;
103
104    #[wasm_bindgen(method, setter, js_name = "traceDeprecation")]
105    pub fn set_trace_deprecation(this: &Process, value: bool);
106
107    #[wasm_bindgen(method, getter, js_name = "traceProcessWarnings")]
108    pub fn trace_process_warnings(this: &Process) -> bool;
109
110    #[wasm_bindgen(method, setter, js_name = "traceProcessWarnings")]
111    pub fn set_trace_process_warnings(this: &Process, value: bool);
112
113    #[wasm_bindgen(method, getter, js_name = "type")] // readonly
114    pub fn kind(this: &Process) -> JsString;
115
116    #[wasm_bindgen(method, getter, js_name = "windowsStore")] // readonly
117    pub fn windows_store(this: &Process) -> bool;
118}