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