Skip to main content

Vine/Server/Notification/
OutputReplace.rs

1//! Cocoon `output.replace` notification - swap the channel's entire
2//! contents. Mapped to `clear` + `append` since Sky has no dedicated
3//! `sky://output/replace` listener yet.
4
5use serde_json::{Value, json};
6
7use crate::{Host::VineHost, dev_log};
8
9pub async fn OutputReplace(Host:&dyn VineHost, Parameter:&Value) {
10	let Channel = Parameter.get("channel").and_then(Value::as_str).unwrap_or("");
11
12	let Text = Parameter.get("text").and_then(Value::as_str).unwrap_or("");
13
14	Host.EmitToRenderer("sky://output/clear", json!({ "channel": Channel }));
15
16	Host.EmitToRenderer(
17		"sky://output/append",
18		json!({
19			"channel": Channel,
20			"text": Text,
21		}),
22	);
23
24	dev_log!("grpc", "[Output] replace channel={} bytes={}", Channel, Text.len());
25}