electron_sys/class/
dock.rs

1use crate::class::{Menu, NativeImage};
2use js_sys::{JsString, Object, Promise};
3use wasm_bindgen::prelude::*;
4
5#[wasm_bindgen(module = "electron")]
6extern {
7    #[wasm_bindgen(extends = Object)]
8    #[derive(Clone, Debug, Eq, PartialEq)]
9    /// Docs: http://electronjs.org/docs/api/dock
10    pub type Dock;
11
12    //******************//
13    // Instance Methods //
14    //******************//
15
16    #[wasm_bindgen(method)]
17    pub fn bounce(this: &Dock, kind: &str) -> u32;
18
19    #[wasm_bindgen(method, js_name = "cancelBounce")]
20    pub fn cancel_bounce(this: &Dock, id: u32);
21
22    #[wasm_bindgen(method, js_name = "downloadFinished")]
23    pub fn download_finished(this: &Dock, file_path: &str);
24
25    #[wasm_bindgen(method, js_name = "getBadge")]
26    pub fn get_badge(this: &Dock) -> JsString;
27
28    #[wasm_bindgen(method, js_name = "getMenu")]
29    pub fn get_menu(this: &Dock) -> Option<Menu>;
30
31    #[wasm_bindgen(method)]
32    pub fn hide(this: &Dock);
33
34    #[wasm_bindgen(method, js_name = "isVisible")]
35    pub fn is_visible(this: &Dock) -> bool;
36
37    #[wasm_bindgen(method, js_name = "setBadge")]
38    pub fn set_badge(this: &Dock, text: &str) -> bool;
39
40    #[wasm_bindgen(method, js_name = "setIcon")]
41    pub fn set_icon(this: &Dock, image: &NativeImage) -> bool;
42
43    #[wasm_bindgen(method, js_name = "setMenu")]
44    pub fn set_menu(this: &Dock, menu: &Menu);
45
46    #[must_use]
47    #[wasm_bindgen(method)]
48    pub fn show(this: &Dock) -> Promise;
49}