script/dom/
xmlhttprequesteventtarget.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use dom_struct::dom_struct;
6
7use crate::dom::bindings::codegen::Bindings::XMLHttpRequestEventTargetBinding::XMLHttpRequestEventTargetMethods;
8use crate::dom::eventtarget::EventTarget;
9
10#[dom_struct]
11pub(crate) struct XMLHttpRequestEventTarget {
12    eventtarget: EventTarget,
13}
14
15impl XMLHttpRequestEventTarget {
16    pub(crate) fn new_inherited() -> XMLHttpRequestEventTarget {
17        XMLHttpRequestEventTarget {
18            eventtarget: EventTarget::new_inherited(),
19        }
20    }
21}
22
23impl XMLHttpRequestEventTargetMethods<crate::DomTypeHolder> for XMLHttpRequestEventTarget {
24    // https://xhr.spec.whatwg.org/#handler-xhr-onloadstart
25    event_handler!(loadstart, GetOnloadstart, SetOnloadstart);
26
27    // https://xhr.spec.whatwg.org/#handler-xhr-onprogress
28    event_handler!(progress, GetOnprogress, SetOnprogress);
29
30    // https://xhr.spec.whatwg.org/#handler-xhr-onabort
31    event_handler!(abort, GetOnabort, SetOnabort);
32
33    // https://xhr.spec.whatwg.org/#handler-xhr-onerror
34    event_handler!(error, GetOnerror, SetOnerror);
35
36    // https://xhr.spec.whatwg.org/#handler-xhr-onload
37    event_handler!(load, GetOnload, SetOnload);
38
39    // https://xhr.spec.whatwg.org/#handler-xhr-ontimeout
40    event_handler!(timeout, GetOntimeout, SetOntimeout);
41
42    // https://xhr.spec.whatwg.org/#handler-xhr-onloadend
43    event_handler!(loadend, GetOnloadend, SetOnloadend);
44}