Skip to main content

Mountain/Vine/Server/Notification/
WebviewPostMessage.rs

1//! Cocoon → Mountain `webview.postMessage` notification.
2//! Emitted by `Cocoon/.../Services/Window/WebviewPanel.ts:125` when an
3//! extension calls `WebviewPanel.webview.postMessage(...)`. Stock VS
4//! Code delivers this as a DOM `message` event inside the webview
5//! `iframe`; in Land we emit on `sky://webview/postMessage` and let the
6//! Sky bridge relay into the specific webview DOM container keyed on
7//! `{ handle, message }`.
8
9use serde_json::Value;
10use tauri::Emitter;
11
12use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
13
14pub async fn WebviewPostMessage(Service:&MountainVinegRPCService, Parameter:&Value) {
15	let _ = Service.ApplicationHandle().emit("sky://webview/postMessage", Parameter);
16
17	dev_log!(
18		"grpc",
19		"[Webview] postMessage handle={}",
20		Parameter.get("handle").and_then(Value::as_str).unwrap_or("?")
21	);
22}