diff --git a/Cargo.toml b/Cargo.toml
index a3a89ca1d..f6df2dbdd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,12 +11,13 @@ members = [
# examples
"examples/api/src-tauri",
+ "examples/commands/src-tauri",
"examples/helloworld/src-tauri",
"examples/multiwindow/src-tauri",
- "examples/commands/src-tauri",
- "examples/splashscreen/src-tauri/",
- "examples/state/src-tauri/",
- "examples/navigation/src-tauri/",
+ "examples/navigation/src-tauri",
+ "examples/params/src-tauri",
+ "examples/splashscreen/src-tauri",
+ "examples/state/src-tauri",
# used to build updater artifacts
"examples/updater/src-tauri",
]
diff --git a/examples/params/package.json b/examples/params/package.json
new file mode 100644
index 000000000..305ea3d20
--- /dev/null
+++ b/examples/params/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "params",
+ "version": "1.0.0",
+ "scripts": {
+ "tauri": "node ../../tooling/cli.js/bin/tauri"
+ }
+}
diff --git a/examples/params/public/index.html b/examples/params/public/index.html
new file mode 100644
index 000000000..b7f3354c9
--- /dev/null
+++ b/examples/params/public/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+{
+}
+impl Params for P where
+ P: tauri::Params
+{
+}
+
+#[derive(Debug, Clone, Hash, Eq, PartialEq)]
+pub enum Event {
+ Foo,
+ Bar,
+ Unknown(String),
+}
+
+impl fmt::Display for Event {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.write_str(match self {
+ Self::Foo => "foo",
+ Self::Bar => "bar",
+ Self::Unknown(s) => &s,
+ })
+ }
+}
+
+impl FromStr for Event {
+ type Err = std::convert::Infallible;
+
+ fn from_str(s: &str) -> Result {
+ Ok(match s {
+ "foo" => Self::Foo,
+ "bar" => Self::Bar,
+ other => Self::Unknown(other.to_string()),
+ })
+ }
+}
+
+#[derive(Debug, Clone, Hash, Eq, PartialEq)]
+pub enum Window {
+ Main,
+}
+
+impl fmt::Display for Window {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.write_str(match self {
+ Self::Main => "main",
+ })
+ }
+}
+
+impl FromStr for Window {
+ type Err = Box;
+
+ fn from_str(s: &str) -> Result {
+ if s == "main" {
+ Ok(Self::Main)
+ } else {
+ Err(format!("only expect main window label, found: {}", s).into())
+ }
+ }
+}
+
+#[derive(Debug, Clone, Hash, Eq, PartialEq, Serialize)]
+pub enum Menu {
+ MenuFoo,
+ MenuBar,
+}
+
+#[derive(Debug, Clone, Hash, Eq, PartialEq, Serialize)]
+pub enum SystemMenu {
+ SystemFoo,
+ SystemBar,
+}
+
+#[command]
+fn log_window_label(window: tauri::Window) {
+ dbg!(window.label());
+}
+
+#[command]
+fn send_foo(window: tauri::Window) {
+ window
+ .emit(&Event::Foo, ())
+ .expect("couldn't send Event::Foo");
+}
+
+fn main() {
+ tauri::Builder::::new()
+ .invoke_handler(tauri::generate_handler![log_window_label, send_foo])
+ .run(tauri::generate_context!())
+ .expect("error while running tauri application");
+}
diff --git a/examples/params/src-tauri/tauri.conf.json b/examples/params/src-tauri/tauri.conf.json
new file mode 100644
index 000000000..c00996bfe
--- /dev/null
+++ b/examples/params/src-tauri/tauri.conf.json
@@ -0,0 +1,56 @@
+{
+ "build": {
+ "distDir": "../public",
+ "devPath": "../public",
+ "beforeDevCommand": "",
+ "beforeBuildCommand": ""
+ },
+ "tauri": {
+ "bundle": {
+ "active": true,
+ "targets": "all",
+ "identifier": "com.tauri.dev",
+ "icon": [
+ "../../.icons/32x32.png",
+ "../../.icons/128x128.png",
+ "../../.icons/128x128@2x.png",
+ "../../.icons/icon.icns",
+ "../../.icons/icon.ico"
+ ],
+ "resources": [],
+ "externalBin": [],
+ "copyright": "",
+ "category": "DeveloperTool",
+ "shortDescription": "",
+ "longDescription": "",
+ "deb": {
+ "depends": [],
+ "useBootstrapper": false
+ },
+ "macOS": {
+ "frameworks": [],
+ "minimumSystemVersion": "",
+ "useBootstrapper": false,
+ "exceptionDomain": ""
+ }
+ },
+ "allowlist": {
+ "all": true
+ },
+ "windows": [
+ {
+ "title": "Welcome to Tauri!",
+ "width": 800,
+ "height": 600,
+ "resizable": true,
+ "fullscreen": false
+ }
+ ],
+ "security": {
+ "csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'"
+ },
+ "updater": {
+ "active": false
+ }
+ }
+}