2022-08-28 21:13:21 +03:00
|
|
|
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
|
2021-04-11 01:09:09 +03:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2021-02-12 03:50:39 +03:00
|
|
|
#![cfg_attr(
|
|
|
|
all(not(debug_assertions), target_os = "windows"),
|
|
|
|
windows_subsystem = "windows"
|
|
|
|
)]
|
|
|
|
|
2021-04-29 01:56:05 +03:00
|
|
|
use tauri::WindowBuilder;
|
2021-02-17 17:15:04 +03:00
|
|
|
|
2021-02-12 03:50:39 +03:00
|
|
|
fn main() {
|
2021-04-06 23:50:53 +03:00
|
|
|
tauri::Builder::default()
|
2021-04-04 03:41:04 +03:00
|
|
|
.on_page_load(|window, _payload| {
|
|
|
|
let label = window.label().to_string();
|
|
|
|
window.listen("clicked".to_string(), move |_payload| {
|
|
|
|
println!("got 'clicked' event on window '{}'", label);
|
2021-02-12 03:50:39 +03:00
|
|
|
});
|
|
|
|
})
|
2022-03-31 20:50:33 +03:00
|
|
|
.setup(|app| {
|
|
|
|
WindowBuilder::new(
|
|
|
|
app,
|
|
|
|
"Rust".to_string(),
|
|
|
|
tauri::WindowUrl::App("index.html".into()),
|
|
|
|
)
|
|
|
|
.title("Tauri - Rust")
|
|
|
|
.build()?;
|
|
|
|
Ok(())
|
|
|
|
})
|
2022-07-04 02:26:32 +03:00
|
|
|
.run(tauri::generate_context!(
|
|
|
|
"../../examples/multiwindow/tauri.conf.json"
|
|
|
|
))
|
2021-04-04 03:41:04 +03:00
|
|
|
.expect("failed to run tauri application");
|
2021-02-12 03:50:39 +03:00
|
|
|
}
|