Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_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};
10
11use crate::{
12	RPC::CocoonService::CocoonServiceImpl,
13	Vine::Generated::{DisposeWebviewPanelRequest, Empty},
14	dev_log,
15};
16
17pub async fn Fn(Service:&CocoonServiceImpl, Request:DisposeWebviewPanelRequest) -> Result<Response<Empty>, Status> {
18	dev_log!("cocoon", "[CocoonService] dispose_webview_panel: handle={}", Request.handle);
19
20	let _ = Service
21		.environment
22		.ApplicationHandle
23		.emit("sky://webview/dispose", json!({ "panelId": Request.handle }));
24
25	Ok(Response::new(Empty {}))
26}