Skip to main content

Mountain/RPC/CocoonService/Window/
DisposeWebviewPanel.rs

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