2024-03-01 11:29:01 +00:00
|
|
|
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
2021-04-10 22:09:09 +00:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
2023-02-18 19:23:09 +00:00
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
2021-02-12 00:50:39 +00:00
|
|
|
|
2024-08-26 22:25:36 +00:00
|
|
|
use tauri::WebviewWindowBuilder;
|
2021-02-17 14:15:04 +00:00
|
|
|
|
2021-02-12 00:50:39 +00:00
|
|
|
fn main() {
|
2024-08-26 22:25:36 +00:00
|
|
|
tauri::Builder::default()
|
|
|
|
|
.setup(|app| {
|
|
|
|
|
WebviewWindowBuilder::new(app, "Third", tauri::WebviewUrl::default())
|
|
|
|
|
.title("Tauri - Third")
|
|
|
|
|
.build()?;
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
})
|
|
|
|
|
.run(generate_context())
|
|
|
|
|
.expect("failed to run tauri application");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn generate_context() -> tauri::Context {
|
2024-02-01 11:06:27 +00:00
|
|
|
let mut context = tauri::generate_context!("../../examples/multiwindow/tauri.conf.json");
|
|
|
|
|
for cmd in [
|
|
|
|
|
"plugin:event|listen",
|
|
|
|
|
"plugin:event|emit",
|
|
|
|
|
"plugin:event|emit_to",
|
2024-08-26 22:25:36 +00:00
|
|
|
"plugin:webview|create_webview_window",
|
2024-02-01 11:06:27 +00:00
|
|
|
] {
|
2024-02-19 14:13:36 +00:00
|
|
|
context
|
|
|
|
|
.runtime_authority_mut()
|
2024-08-26 22:25:36 +00:00
|
|
|
.__allow_command(cmd.to_string(), tauri_utils::acl::ExecutionContext::Local);
|
2024-02-01 11:06:27 +00:00
|
|
|
}
|
2024-08-26 22:25:36 +00:00
|
|
|
context
|
2021-02-12 00:50:39 +00:00
|
|
|
}
|