Optimize code format
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pake-cli",
|
||||
"version": "1.0.1",
|
||||
"version": "1.3.1",
|
||||
"description": "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.",
|
||||
"engines": {
|
||||
"node": "^14.13 || >=16.0.0"
|
||||
|
||||
@@ -30,9 +30,9 @@ pub fn open_browser(app: AppHandle, url: String) {
|
||||
|
||||
#[command]
|
||||
pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result<(), String> {
|
||||
let window: Window = app.get_window("pake").unwrap().clone();
|
||||
let window: Window = app.get_window("pake").unwrap();
|
||||
let output_path = api::path::download_dir().unwrap().join(params.filename);
|
||||
let file_path = check_file_or_append(&output_path.to_str().unwrap());
|
||||
let file_path = check_file_or_append(output_path.to_str().unwrap());
|
||||
let download = Download::new(¶ms.url, Some(&file_path), None);
|
||||
match download.download() {
|
||||
Ok(_) => {
|
||||
|
||||
@@ -32,10 +32,8 @@ pub fn get_menu() -> Menu {
|
||||
}
|
||||
|
||||
pub fn menu_event_handle(event: WindowMenuEvent) {
|
||||
match event.menu_item_id() {
|
||||
// default close to minimize
|
||||
"close" => event.window().minimize().expect("can't minimize window"),
|
||||
_ => {}
|
||||
if event.menu_item_id() == "close" {
|
||||
event.window().minimize().expect("can't minimize window");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user