Mountain/RPC/CocoonService/Window/DisposeWebviewPanel.rs
1//! Dispose a webview panel. The Sky listener at `SkyBridge.ts:2344`
2//! destructures `{ panelId }`; the older sibling emitter at
3//! `RPC/CocoonService/mod.rs:1235` already uses `panelId` - keep this
4//! site aligned so a `dispose` from either path lands in the same DOM
5//! `cel:webview:dispose` CustomEvent.
6
7use serde_json::json;
8use tauri::Emitter;
9use tonic::{Response, Status};
10use ::Vine::Generated::{DisposeWebviewPanelRequest, Empty};
11
12use crate::{RPC::CocoonService::CocoonServiceImpl, dev_log};
13
14pub async fn Fn(Service:&CocoonServiceImpl, Request:DisposeWebviewPanelRequest) -> Result<Response<Empty>, Status> {
15 dev_log!("cocoon", "[CocoonService] dispose_webview_panel: handle={}", Request.handle);
16
17 let _ = Service
18 .environment
19 .ApplicationHandle
20 .emit("sky://webview/dispose", json!({ "panelId": Request.handle }));
21
22 Ok(Response::new(Empty {}))
23}