script/dom/
fetchlaterresult.rs1use dom_struct::dom_struct;
6use script_bindings::reflector::{Reflector, reflect_dom_object};
7
8use crate::dom::bindings::codegen::Bindings::FetchLaterResultBinding::FetchLaterResultMethods;
9use crate::dom::bindings::reflector::DomGlobal;
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::window::Window;
12use crate::fetch::DeferredFetchRecordId;
13use crate::script_runtime::CanGc;
14
15#[dom_struct]
17pub(crate) struct FetchLaterResult {
18 reflector_: Reflector,
19
20 #[no_trace]
22 deferred_record_id: DeferredFetchRecordId,
23}
24
25impl FetchLaterResult {
26 fn new_inherited(deferred_record_id: DeferredFetchRecordId) -> FetchLaterResult {
27 FetchLaterResult {
28 reflector_: Reflector::new(),
29 deferred_record_id,
30 }
31 }
32
33 pub(crate) fn new(
34 window: &Window,
35 deferred_record_id: DeferredFetchRecordId,
36 can_gc: CanGc,
37 ) -> DomRoot<FetchLaterResult> {
38 reflect_dom_object(
39 Box::new(FetchLaterResult::new_inherited(deferred_record_id)),
40 window,
41 can_gc,
42 )
43 }
44}
45
46impl FetchLaterResultMethods<crate::DomTypeHolder> for FetchLaterResult {
47 fn Activated(&self) -> bool {
49 self.global()
51 .deferred_fetch_record_for_id(&self.deferred_record_id)
52 .activated_getter_steps()
53 }
54}