web_extensions_sys/
history.rs

1//! Bindings to the `history` API.
2
3use js_sys::{Number, Object};
4use wasm_bindgen::prelude::*;
5
6#[wasm_bindgen]
7extern "C" {
8    pub type History;
9
10    #[wasm_bindgen(method)]
11    pub async fn search(this: &History, query: &Object) -> JsValue;
12}
13
14#[wasm_bindgen]
15extern "C" {
16
17    // An object encapsulating one result of a history query.
18    pub type HistoryItem;
19
20    // The unique identifier for the item.
21    #[wasm_bindgen(method, getter)]
22    pub fn id(this: &HistoryItem) -> String;
23
24    // When this page was last loaded, represented in milliseconds since the epoch.
25    #[wasm_bindgen(method, getter, js_name = lastVisitTime)]
26    pub fn last_visit_time(this: &HistoryItem) -> Option<Number>;
27
28    // The title of the page when it was last loaded.
29    #[wasm_bindgen(method, getter)]
30    pub fn title(this: &HistoryItem) -> Option<String>;
31
32    // The number of times the user has navigated to this page by typing in the address.
33    #[wasm_bindgen(method, getter, js_name = typedCount)]
34    pub fn typed_count(this: &HistoryItem) -> Option<Number>;
35
36    // The URL navigated to by a user.
37    #[wasm_bindgen(method, getter)]
38    pub fn url(this: &HistoryItem) -> Option<String>;
39
40    // The number of times the user has navigated to this page.
41    #[wasm_bindgen(method, getter, js_name = visitCount)]
42    pub fn visit_count(this: &HistoryItem) -> Option<Number>;
43}