electron_sys/interface/
protocol.rs1use js_sys::{Function, Promise};
2use wasm_bindgen::prelude::*;
3
4#[wasm_bindgen]
5extern {
6 #[derive(Clone, Debug)]
7 pub type Protocol;
8
9 #[wasm_bindgen(method, js_name = "interceptBufferProtocol")]
10 pub fn intercept_buffer_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
11
12 #[wasm_bindgen(method, js_name = "interceptFileProtocol")]
13 pub fn intercept_file_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
14
15 #[wasm_bindgen(method, js_name = "interceptHttpProtocol")]
16 pub fn intercept_http_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
17
18 #[wasm_bindgen(method, js_name = "interceptStreamProtocol")]
19 pub fn intercept_stream_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
20
21 #[wasm_bindgen(method, js_name = "interceptStringProtocol")]
22 pub fn intercept_string_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
23
24 #[must_use]
25 #[wasm_bindgen(method, js_name = "isProtocolHandled")]
26 pub fn is_protocol_handled(this: &Protocol, scheme: &str) -> Promise;
27
28 #[wasm_bindgen(method, js_name = "registerBufferProtocol")]
29 pub fn register_buffer_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
30
31 #[wasm_bindgen(method, js_name = "registerFileProtocol")]
32 pub fn register_file_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
33
34 #[wasm_bindgen(method, js_name = "registerHttpProtocol")]
35 pub fn register_http_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
36
37 #[wasm_bindgen(method, js_name = "registerSchemesAsPriviledged")]
38 pub fn register_schemes_as_privileged(this: &Protocol, custom_schemes: Box<[JsValue]>);
39
40 #[wasm_bindgen(method, js_name = "registerStreamProtocol")]
41 pub fn register_stream_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
42
43 #[wasm_bindgen(method, js_name = "registerStringProtocol")]
44 pub fn register_string_protocol(this: &Protocol, scheme: &str, handler: &Function, completion: Option<&Function>);
45
46 #[wasm_bindgen(method, js_name = "uninterceptProtocol")]
47 pub fn unintercept_protocol(this: &Protocol, scheme: &str, completion: Option<&Function>);
48
49 #[wasm_bindgen(method, js_name = "unregisterProtocol")]
50 pub fn unregister_protocl(this: &Protocol, scheme: &str, completion: Option<&Function>);
51}