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