-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9f1668
commit 2296c63
Showing
5 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Hello World Example | ||
|
||
To execute run the following on the root directory of the repository: `cargo run --example helloworld`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Welcome to Tauri!</title> | ||
</head> | ||
<body> | ||
<h1>Welcome to Tauri!</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-License-Identifier: MIT | ||
|
||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
|
||
use tauri::{LogicalPosition, LogicalSize, WebviewUrl}; | ||
|
||
fn main() { | ||
tauri::Builder::default() | ||
.setup(|app| { | ||
let width = 800.; | ||
let height = 600.; | ||
let window = tauri::WindowBuilder::new(app, "main") | ||
.inner_size(width, height) | ||
.build()?; | ||
|
||
let _webview1 = window.add_child( | ||
tauri::WebviewBuilder::new("main1", WebviewUrl::App(Default::default())), | ||
LogicalPosition::new(0., 0.), | ||
LogicalSize::new(width / 2., height / 2.), | ||
)?; | ||
let _webview2 = window.add_child( | ||
tauri::WebviewBuilder::new( | ||
"main2", | ||
WebviewUrl::External("https://github.com/tauri-apps/tauri".parse().unwrap()), | ||
), | ||
LogicalPosition::new(width / 2., 0.), | ||
LogicalSize::new(width / 2., height / 2.), | ||
)?; | ||
let _webview3 = window.add_child( | ||
tauri::WebviewBuilder::new( | ||
"main3", | ||
WebviewUrl::External("https://tauri.app".parse().unwrap()), | ||
), | ||
LogicalPosition::new(0., height / 2.), | ||
LogicalSize::new(width / 2., height / 2.), | ||
)?; | ||
let _webview4 = window.add_child( | ||
tauri::WebviewBuilder::new( | ||
"main4", | ||
WebviewUrl::External("https://twitter.com/TauriApps".parse().unwrap()), | ||
), | ||
LogicalPosition::new(width / 2., height / 2.), | ||
LogicalSize::new(width / 2., height / 2.), | ||
)?; | ||
|
||
Ok(()) | ||
}) | ||
.run(tauri::generate_context!( | ||
"../../examples/multiwebview/tauri.conf.json" | ||
)) | ||
.expect("error while running tauri application"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"$schema": "../../core/tauri-config-schema/schema.json", | ||
"build": { | ||
"distDir": ["index.html"], | ||
"devPath": ["index.html"], | ||
"beforeDevCommand": "", | ||
"beforeBuildCommand": "" | ||
}, | ||
"package": { | ||
"productName": "MultiWebview", | ||
"version": "0.1.0" | ||
}, | ||
"tauri": { | ||
"bundle": { | ||
"active": true, | ||
"targets": "all", | ||
"identifier": "com.tauri.dev", | ||
"icon": [ | ||
"../.icons/32x32.png", | ||
"../.icons/128x128.png", | ||
"../.icons/[email protected]", | ||
"../.icons/icon.icns", | ||
"../.icons/icon.ico" | ||
], | ||
"resources": [], | ||
"externalBin": [], | ||
"copyright": "", | ||
"category": "DeveloperTool", | ||
"shortDescription": "", | ||
"longDescription": "", | ||
"deb": { | ||
"depends": [] | ||
}, | ||
"macOS": { | ||
"frameworks": [], | ||
"exceptionDomain": "" | ||
} | ||
}, | ||
"security": { | ||
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost" | ||
} | ||
} | ||
} |