This commit is contained in:
Gregory Schier
2025-01-26 13:13:45 -08:00
committed by GitHub
parent 82b1ad35ff
commit f678593903
99 changed files with 3492 additions and 1583 deletions

View File

@@ -26,6 +26,10 @@ impl PluginHandle {
}
}
pub async fn name(&self) -> String {
self.boot_resp.lock().await.name.clone()
}
pub async fn info(&self) -> BootResponse {
let resp = &*self.boot_resp.lock().await;
resp.clone()
@@ -33,7 +37,7 @@ impl PluginHandle {
pub fn build_event_to_send(
&self,
window_context: WindowContext,
window_context: &WindowContext,
payload: &InternalEventPayload,
reply_id: Option<String>,
) -> InternalEvent {
@@ -42,7 +46,7 @@ impl PluginHandle {
pub(crate) fn build_event_to_send_raw(
&self,
window_context: WindowContext,
window_context: &WindowContext,
payload: &InternalEventPayload,
reply_id: Option<String>,
) -> InternalEvent {
@@ -53,18 +57,18 @@ impl PluginHandle {
plugin_name: dir.file_name().unwrap().to_str().unwrap().to_string(),
reply_id,
payload: payload.clone(),
window_context,
window_context: window_context.clone(),
}
}
pub async fn terminate(&self, window_context: WindowContext) -> Result<()> {
pub async fn terminate(&self, window_context: &WindowContext) -> Result<()> {
info!("Terminating plugin {}", self.dir);
let event =
self.build_event_to_send(window_context, &InternalEventPayload::TerminateRequest, None);
self.send(&event).await
}
pub(crate) async fn send(&self, event: &InternalEvent) -> Result<()> {
pub async fn send(&self, event: &InternalEvent) -> Result<()> {
self.to_plugin_tx.lock().await.send(event.to_owned()).await?;
Ok(())
}