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
use crate::interface::SaveDialogOptions;
use js_sys::JsString;
use node_sys::events::EventEmitter;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(module = "electron")]
extern {
    #[wasm_bindgen(extends = EventEmitter)]
    #[derive(Clone, Debug, Eq, PartialEq)]
    /// Docs: http://electronjs.org/docs/api/download-item
    pub type DownloadItem;

    //******************//
    // Instance Methods //
    //******************//

    #[wasm_bindgen(method)]
    pub fn cancel(this: &DownloadItem);

    #[wasm_bindgen(method, js_name = "canResume")]
    pub fn can_resume(this: &DownloadItem) -> bool;

    #[wasm_bindgen(method, js_name = "getContentDisposition")]
    pub fn get_content_disposition(this: &DownloadItem) -> JsString;

    #[wasm_bindgen(method, js_name = "getETag")]
    pub fn get_etag(this: &DownloadItem) -> JsString;

    #[wasm_bindgen(method, js_name = "getFilename")]
    pub fn get_filename(this: &DownloadItem) -> JsString;

    #[wasm_bindgen(method, js_name = "getLastModifiedTime")]
    pub fn get_last_modified_time(this: &DownloadItem) -> JsString;

    #[wasm_bindgen(method, js_name = "getMimeType")]
    pub fn get_mime_type(this: &DownloadItem) -> JsString;

    #[wasm_bindgen(method, js_name = "getReceivedBytes")]
    pub fn get_received_bytes(this: &DownloadItem) -> usize;

    #[wasm_bindgen(method, js_name = "getSaveDialogOptions")]
    pub fn get_save_dialog_options(this: &DownloadItem) -> SaveDialogOptions;

    #[wasm_bindgen(method, js_name = "getSavePath")]
    pub fn get_save_path(this: &DownloadItem) -> JsString;

    #[wasm_bindgen(method, js_name = "getSavePath")]
    pub fn get_start_time(this: &DownloadItem) -> u32;

    #[wasm_bindgen(method, js_name = "getState")]
    pub fn get_state(this: &DownloadItem) -> JsString;

    #[wasm_bindgen(method, js_name = "getTotalBytes")]
    pub fn get_total_bytes(this: &DownloadItem) -> usize;

    #[wasm_bindgen(method, js_name = "getURL")]
    pub fn get_url(this: &DownloadItem) -> JsString;

    #[wasm_bindgen(method, js_name = "getURLChain")]
    pub fn get_url_chain(this: &DownloadItem) -> Box<[JsValue]>;

    #[wasm_bindgen(method, js_name = "has_user_gesture")]
    pub fn has_user_gesture(this: &DownloadItem) -> bool;

    #[wasm_bindgen(method, js_name = "is_paused")]
    pub fn is_paused(this: &DownloadItem) -> bool;

    #[wasm_bindgen(method)]
    pub fn pause(this: &DownloadItem);

    #[wasm_bindgen(method)]
    pub fn resume(this: &DownloadItem);

    #[wasm_bindgen(method, js_name = "setSaveDialogOptions")]
    pub fn set_save_dialog_options(this: &DownloadItem, options: SaveDialogOptions);

    //*********************//
    // Instance Properties //
    //*********************//

    #[wasm_bindgen(method, getter, js_name = "savePath")]
    pub fn save_path(this: &DownloadItem) -> JsString;

    #[wasm_bindgen(method, setter, js_name = "savePath")]
    pub fn set_save_path(this: &DownloadItem, value: JsString);
}