use dom_struct::dom_struct;
use crate::dom::bindings::codegen::Bindings::FetchLaterResultBinding::FetchLaterResultMethods;
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object};
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
use crate::fetch::DeferredFetchRecordId;
use crate::script_runtime::CanGc;
#[dom_struct]
pub(crate) struct FetchLaterResult {
reflector_: Reflector,
#[no_trace]
deferred_record_id: DeferredFetchRecordId,
}
impl FetchLaterResult {
fn new_inherited(deferred_record_id: DeferredFetchRecordId) -> FetchLaterResult {
FetchLaterResult {
reflector_: Reflector::new(),
deferred_record_id,
}
}
pub(crate) fn new(
window: &Window,
deferred_record_id: DeferredFetchRecordId,
can_gc: CanGc,
) -> DomRoot<FetchLaterResult> {
reflect_dom_object(
Box::new(FetchLaterResult::new_inherited(deferred_record_id)),
window,
can_gc,
)
}
}
impl FetchLaterResultMethods<crate::DomTypeHolder> for FetchLaterResult {
fn Activated(&self) -> bool {
self.global()
.deferred_fetch_record_for_id(&self.deferred_record_id)
.activated_getter_steps()
}
}