mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
chore(deps): update to tauri beta.9 (#1037)
This commit is contained in:
committed by
GitHub
parent
16fc0f2ee3
commit
cacf544d51
@@ -7,7 +7,10 @@ mod cmd;
|
||||
mod tray;
|
||||
|
||||
use serde::Serialize;
|
||||
use tauri::{webview::WebviewWindowBuilder, App, AppHandle, Manager, RunEvent, WebviewUrl};
|
||||
use tauri::{
|
||||
webview::{PageLoadEvent, WebviewWindowBuilder},
|
||||
App, AppHandle, Manager, RunEvent, WebviewUrl,
|
||||
};
|
||||
|
||||
#[derive(Clone, Serialize)]
|
||||
struct Reply {
|
||||
@@ -107,18 +110,20 @@ pub fn run() {
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.on_page_load(|webview, _| {
|
||||
let webview_ = webview.clone();
|
||||
webview.listen("js-event", move |event| {
|
||||
println!("got js-event with message '{:?}'", event.payload());
|
||||
let reply = Reply {
|
||||
data: "something else".to_string(),
|
||||
};
|
||||
.on_page_load(|webview, payload| {
|
||||
if payload.event() == PageLoadEvent::Finished {
|
||||
let webview_ = webview.clone();
|
||||
webview.listen("js-event", move |event| {
|
||||
println!("got js-event with message '{:?}'", event.payload());
|
||||
let reply = Reply {
|
||||
data: "something else".to_string(),
|
||||
};
|
||||
|
||||
webview_
|
||||
.emit("rust-event", Some(reply))
|
||||
.expect("failed to emit");
|
||||
});
|
||||
webview_
|
||||
.emit("rust-event", Some(reply))
|
||||
.expect("failed to emit");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
@@ -79,11 +79,14 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
|
||||
}
|
||||
i @ "icon-1" | i @ "icon-2" => {
|
||||
if let Some(tray) = app.tray_by_id("tray-1") {
|
||||
let _ = tray.set_icon(Some(tauri::Icon::Raw(if i == "icon-1" {
|
||||
include_bytes!("../icons/icon.ico").to_vec()
|
||||
let _ = tray.set_icon(Some(if i == "icon-1" {
|
||||
tauri::Image::from_ico_bytes(include_bytes!("../icons/icon.ico")).unwrap()
|
||||
} else {
|
||||
include_bytes!("../icons/tray_icon_with_transparency.png").to_vec()
|
||||
})));
|
||||
tauri::Image::from_png_bytes(include_bytes!(
|
||||
"../icons/tray_icon_with_transparency.png"
|
||||
))
|
||||
.unwrap()
|
||||
}));
|
||||
}
|
||||
}
|
||||
"switch-menu" => {
|
||||
|
||||
Reference in New Issue
Block a user