use crate::prelude::PassedUrl;
use crate::webview::handlers::RegisterWryEvent;
use bevy::prelude::{App, Entity, Event, Plugin, Reflect};
use std::path::PathBuf;
#[derive(Clone, Debug, Event, Reflect)]
pub struct DownloadStarted {
pub webview_entity: Entity,
pub source_url: PassedUrl,
pub dest: PathBuf,
}
#[derive(Clone, Debug, Event, Reflect)]
pub struct DownloadCompleted {
pub webview_entity: Entity,
pub source_url: PassedUrl,
pub dest: Option<PathBuf>,
pub succeed: bool,
}
pub(crate) struct DownloadPlugin;
impl Plugin for DownloadPlugin {
fn build(&self, app: &mut App) {
app.register_wry_event::<DownloadStarted>()
.register_wry_event::<DownloadCompleted>();
}
}