chrome_types/sys/tabs/
mod.rs1pub mod tab;
2
3use js_sys::Object;
4use tab::Tab;
5use wasm_bindgen::prelude::*;
6
7#[wasm_bindgen]
8extern "C" {
9 pub type Tabs;
11
12 #[wasm_bindgen(method, catch, js_name = "create")]
13 pub async fn create(this: &Tabs, properties: &CreateProperties) -> Result<Tab, JsValue>;
14}
15
16#[wasm_bindgen]
17extern "C" {
18 pub type CreateProperties;
19
20 #[wasm_bindgen(method, getter = "active")]
21 pub fn active(this: &CreateProperties) -> Option<bool>;
22 #[wasm_bindgen(method, setter = "active")]
23 pub fn set_active(this: &CreateProperties, yes: bool);
24
25 #[wasm_bindgen(method, getter = "index")]
26 pub fn index(this: &CreateProperties) -> Option<u32>;
27 #[wasm_bindgen(method, setter = "index")]
28 pub fn set_index(this: &CreateProperties, number: u32);
29
30 #[wasm_bindgen(method, getter = "openerTabId")]
31 pub fn opener_tab_id(this: &CreateProperties) -> Option<u32>;
32 #[wasm_bindgen(method, setter = "openerTabId")]
33 pub fn set_opener_tab_id(this: &CreateProperties, id: u32);
34
35 #[wasm_bindgen(method, getter = "pinned")]
36 pub fn pinned(this: &CreateProperties) -> Option<bool>;
37 #[wasm_bindgen(method, setter = "pinned")]
38 pub fn set_pinned(this: &CreateProperties, yes: bool);
39
40 #[wasm_bindgen(method, getter = "url")]
41 pub fn url(this: &CreateProperties) -> Option<String>;
42 #[wasm_bindgen(method, setter = "url")]
43 pub fn set_url(this: &CreateProperties, url: &str);
44
45 #[wasm_bindgen(method, getter = "windowId")]
46 pub fn window_id(this: &CreateProperties) -> Option<u32>;
47 #[wasm_bindgen(method, setter = "windowId")]
48 pub fn set_window_id(this: &CreateProperties, id: u32);
49}
50
51impl CreateProperties {
52 pub fn new() -> Self {
53 Object::new().unchecked_into()
54 }
55}
56
57impl Default for CreateProperties {
58 fn default() -> Self {
59 Self::new()
60 }
61}