#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum DocumentLoadState {
Commit,
DomContentLoaded,
#[default]
Load,
NetworkIdle,
}
impl DocumentLoadState {
pub fn is_reached(&self, current: Self) -> bool {
current >= *self
}
pub fn cdp_event_name(&self) -> Option<&'static str> {
match self {
Self::Commit | Self::NetworkIdle => None,
Self::DomContentLoaded => Some("Page.domContentEventFired"),
Self::Load => Some("Page.loadEventFired"),
}
}
}
#[cfg(test)]
mod tests;