Skip to content
Snippets Groups Projects
Commit e32bfd9a authored by GyDi's avatar GyDi
Browse files

feat: Window Send and Sync

parent 7e47f8f8
No related branches found
No related tags found
No related merge requests found
extern crate warp;
use port_scanner::local_port_available;
use std::sync::{Arc, Mutex};
use tauri::{AppHandle, Manager};
use warp::Filter;
......@@ -23,13 +22,12 @@ pub fn check_singleton() -> Result<(), ()> {
/// The embed server only be used to implement singleton process
/// maybe it can be used as pac server later
pub fn embed_server(app: &AppHandle) {
let window = Arc::new(Mutex::new(app.get_window("main").unwrap()));
let window = app.get_window("main").unwrap();
tauri::async_runtime::spawn(async move {
let commands = warp::path!("commands" / "visible").map(move || {
let win = window.lock().unwrap();
win.show().unwrap();
win.set_focus().unwrap();
window.show().unwrap();
window.set_focus().unwrap();
return format!("ok");
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment