-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Showing
36 changed files
with
922 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 @@ | ||
/dist/ | ||
/target/ | ||
/Cargo.lock |
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 @@ | ||
/src | ||
/public | ||
/Cargo.toml |
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 @@ | ||
{ | ||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] | ||
} |
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,5 @@ | ||
{ | ||
"emmet.includeLanguages": { | ||
"rust": "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,22 @@ | ||
[package] | ||
name = "test-tauri-events-ui" | ||
version = "0.0.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[dependencies] | ||
leptos = { version = "0.6", features = ["csr", "nightly"] } | ||
wasm-bindgen = "0.2" | ||
wasm-bindgen-futures = "0.4" | ||
js-sys = "0.3" | ||
serde = { version = "1", features = ["derive"] } | ||
serde-wasm-bindgen = "0.6" | ||
console_error_panic_hook = "0.1.7" | ||
tauri-sys = { path = "../tauri-sys", features = ["all"] } | ||
futures = "0.3" | ||
tracing = "0.1.40" | ||
tracing-subscriber = "0.3.18" | ||
tracing-web = "0.1.3" | ||
|
||
[workspace] | ||
members = ["src-tauri"] |
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,7 @@ | ||
# Tauri + Leptos | ||
|
||
This template should help get you started developing with Tauri and Leptos. | ||
|
||
## Recommended IDE Setup | ||
|
||
[VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). |
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,10 @@ | ||
[build] | ||
target = "./index.html" | ||
|
||
[watch] | ||
ignore = ["./src-tauri"] | ||
|
||
[serve] | ||
address = "127.0.0.1" | ||
port = 1420 | ||
open = false |
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> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Tauri + Leptos App</title> | ||
<link data-trunk rel="css" href="styles.css" /> | ||
<link data-trunk rel="copy-dir" href="public" /> | ||
<link data-trunk rel="rust" data-wasm-opt="z" /> | ||
</head> | ||
<body></body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,7 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
|
||
# Generated by Tauri | ||
# will have schema files for capabilities auto-completion | ||
/gen/schemas |
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,20 @@ | ||
[package] | ||
name = "test-tauri-events" | ||
version = "0.0.0" | ||
description = "A Tauri App" | ||
authors = ["you"] | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[build-dependencies] | ||
# tauri-build = { version = "2.0.0-beta", features = [] } | ||
tauri-build = { path = "../../tauri/core/tauri-build", features = [] } | ||
|
||
[dependencies] | ||
tauri = { path = "../../tauri/core/tauri", features = [] } | ||
tauri-plugin-shell = { path = "../../plugins-workspace/plugins/shell" } | ||
serde = { version = "1", features = ["derive"] } | ||
serde_json = "1" | ||
tracing = "0.1.40" | ||
tracing-subscriber = "0.3.18" |
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 @@ | ||
fn main() { | ||
tauri_build::build() | ||
} |
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,17 @@ | ||
{ | ||
"$schema": "../gen/schemas/desktop-schema.json", | ||
"identifier": "default", | ||
"description": "Capability for the main window", | ||
"windows": ["main"], | ||
"permissions": [ | ||
"core:path:default", | ||
"core:event:default", | ||
"core:window:default", | ||
"core:app:default", | ||
"core:image:default", | ||
"core:resources:default", | ||
"core:menu:default", | ||
"core:tray:default", | ||
"shell:allow-open" | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,41 @@ | ||
// Prevents additional console window on Windows in release, DO NOT REMOVE!! | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
|
||
use tauri::{Emitter, Manager}; | ||
|
||
fn main() { | ||
logging::enable(); | ||
tauri::Builder::default() | ||
.invoke_handler(tauri::generate_handler![trigger_listen_events,]) | ||
.run(tauri::generate_context!()) | ||
.expect("error while running tauri application"); | ||
} | ||
|
||
#[tauri::command] | ||
fn trigger_listen_events(app: tauri::AppHandle) { | ||
tracing::debug!("trigger_listen_event"); | ||
std::thread::spawn({ | ||
move || { | ||
for i in 1..=100 { | ||
app.emit("event::listen", i).unwrap(); | ||
std::thread::sleep(std::time::Duration::from_millis(500)); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
mod logging { | ||
use tracing_subscriber::{filter::LevelFilter, fmt, prelude::*, Layer, Registry}; | ||
|
||
const MAX_LOG_LEVEL: LevelFilter = LevelFilter::DEBUG; | ||
|
||
pub fn enable() { | ||
let console_logger = fmt::layer() | ||
.with_writer(std::io::stdout) | ||
.pretty() | ||
.with_filter(MAX_LOG_LEVEL); | ||
|
||
let subscriber = Registry::default().with(console_logger); | ||
tracing::subscriber::set_global_default(subscriber).unwrap(); | ||
} | ||
} |
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,35 @@ | ||
{ | ||
"productName": "test-tauri-events", | ||
"version": "0.0.0", | ||
"identifier": "com.tauri.dev", | ||
"build": { | ||
"beforeDevCommand": "trunk serve", | ||
"devUrl": "http://localhost:1420", | ||
"beforeBuildCommand": "trunk build", | ||
"frontendDist": "../dist" | ||
}, | ||
"app": { | ||
"withGlobalTauri": true, | ||
"windows": [ | ||
{ | ||
"title": "test-tauri-events", | ||
"width": 800, | ||
"height": 600 | ||
} | ||
], | ||
"security": { | ||
"csp": null | ||
} | ||
}, | ||
"bundle": { | ||
"active": true, | ||
"targets": "all", | ||
"icon": [ | ||
"icons/32x32.png", | ||
"icons/128x128.png", | ||
"icons/[email protected]", | ||
"icons/icon.icns", | ||
"icons/icon.ico" | ||
] | ||
} | ||
} |
Oops, something went wrong.