Skip to main content

Mountain/RPC/CocoonService/Window/
DisposeWebviewPanel.rs

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