1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use crate::tabs::Tab;
use crate::windows::Window;
use crate::EventTarget;
use js_sys::Object;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[derive(Debug)]
pub type Session;
#[wasm_bindgen(method, getter, js_name = lastModified)]
pub fn last_modified(this: &Session) -> f64;
#[wasm_bindgen(method, getter)]
pub fn tab(this: &Session) -> Option<Tab>;
#[wasm_bindgen(method, getter)]
pub fn window(this: &Session) -> Option<Window>;
}
#[wasm_bindgen]
extern "C" {
pub type Sessions;
#[wasm_bindgen(method, getter, js_name = MAX_SESSION_RESULTS)]
pub fn max_session_results(this: &Sessions) -> u32;
#[wasm_bindgen(catch, method, js_name = forgetClosedTab)]
pub async fn forget_closed_tab(
this: &Sessions,
window_id: i32,
session_id: &str,
) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, method, js_name = forgetClosedWindow)]
pub async fn forget_closed_window(
this: &Sessions,
session_id: &str,
) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, method, js_name = getRecentlyClosed)]
pub async fn get_recently_closed(
this: &Sessions,
filter: Option<&Object>,
) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, method)]
pub async fn restore(this: &Sessions, session_id: &str) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, method, js_name = getTabValue)]
pub async fn get_tab_value(this: &Sessions, tab_id: i32, key: &str)
-> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, method, js_name = setTabValue)]
pub async fn set_tab_value(
this: &Sessions,
tab_id: i32,
key: &str,
value: &JsValue,
) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, method, js_name = removeTabValue)]
pub async fn remove_tab_value(
this: &Sessions,
tab_id: i32,
key: &str,
) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, method, js_name = getWindowValue)]
pub async fn get_window_value(
this: &Sessions,
window_id: i32,
key: &str,
) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, method, js_name = setWindowValue)]
pub async fn set_window_value(
this: &Sessions,
window_id: i32,
key: &str,
value: &JsValue,
) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch, method, js_name = removeWindowValue)]
pub async fn remove_window_value(
this: &Sessions,
window_id: i32,
key: &str,
) -> Result<JsValue, JsValue>;
#[wasm_bindgen(method, getter, js_name = onChanged)]
pub fn on_changed(this: &Sessions) -> EventTarget;
}