2022-01-17 16:46:14 +03:00
|
|
|
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
#![cfg_attr(
|
|
|
|
all(not(debug_assertions), target_os = "windows"),
|
|
|
|
windows_subsystem = "windows"
|
|
|
|
)]
|
|
|
|
|
|
|
|
use std::time::Instant;
|
|
|
|
|
|
|
|
#[tauri::command]
|
|
|
|
fn ping() {
|
|
|
|
dbg!(format!("ping: {:?}", Instant::now()));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(feature = "isolation"))]
|
|
|
|
fn main() {
|
|
|
|
compile_error!("Feature `isolation` is required to run this example");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "isolation")]
|
|
|
|
fn main() {
|
2022-06-15 16:51:40 +03:00
|
|
|
let context = tauri::generate_context!("../../examples/isolation/tauri.conf.json");
|
2022-01-17 16:46:14 +03:00
|
|
|
tauri::Builder::default()
|
2022-06-29 20:03:42 +03:00
|
|
|
.menu(if cfg!(target_os = "macos") {
|
|
|
|
tauri::Menu::os_default(&context.package_info().name)
|
|
|
|
} else {
|
|
|
|
tauri::Menu::default()
|
|
|
|
})
|
2022-01-17 16:46:14 +03:00
|
|
|
.invoke_handler(tauri::generate_handler![ping])
|
2022-06-15 16:51:40 +03:00
|
|
|
.run(context)
|
2022-01-17 16:46:14 +03:00
|
|
|
.expect("error while running tauri application");
|
|
|
|
}
|