Skip to content

Commit

Permalink
feat: Window Send and Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzgydi committed Jan 4, 2022
1 parent 7e47f8f commit e32bfd9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src-tauri/src/utils/server.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
extern crate warp;

use port_scanner::local_port_available;
use std::sync::{Arc, Mutex};
use tauri::{AppHandle, Manager};
use warp::Filter;

Expand All @@ -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");
});

Expand Down

0 comments on commit e32bfd9

Please sign in to comment.