Skip to main content

Vine/Server/Notification/
ProgressStart.rs

1//! Cocoon `progress.start` notification. Fires at the top of every
2//! `vscode.window.withProgress(...)` call. Normalised onto
3//! `sky://notification/progress-begin`.
4
5use serde_json::{Value, json};
6
7use crate::Host::VineHost;
8
9pub async fn ProgressStart(Host:&dyn VineHost, Parameter:&Value) {
10	let Handle = Parameter.get("handle").and_then(Value::as_str).unwrap_or("");
11
12	let Title = Parameter.get("title").and_then(Value::as_str).unwrap_or("");
13
14	let Cancellable = Parameter.get("cancellable").and_then(Value::as_bool).unwrap_or(false);
15
16	Host.EmitToRenderer(
17		"sky://notification/progress-begin",
18		json!({
19			"id": Handle,
20			"title": Title,
21			"cancellable": Cancellable,
22		}),
23	);
24}