diff --git a/index.html b/index.html
index 99f203f..bbfd6ef 100644
--- a/index.html
+++ b/index.html
@@ -2,9 +2,9 @@
-
+
- Tauri + Vue + Typescript App
+ Heartbeat Cat Desktop
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index c41c471..dc52a75 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -11,7 +11,7 @@ edition = "2021"
tauri-build = { version = "1", features = [] }
[dependencies]
-tauri = { version = "1", features = [ "dialog-all", "window-show", "window-hide", "window-maximize", "window-unmaximize", "window-unminimize", "window-start-dragging", "window-minimize", "window-close", "shell-open"] }
+tauri = { version = "1", features = [ "window-create", "path-all", "dialog-all", "window-show", "window-hide", "window-maximize", "window-unmaximize", "window-unminimize", "window-start-dragging", "window-minimize", "window-close", "shell-open"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
btleplug = { version = "0.11.5", features = ["serde"] }
diff --git a/src-tauri/addons/widgets/example/widget.html b/src-tauri/addons/widgets/example/widget.html
new file mode 100644
index 0000000..31c9bb2
--- /dev/null
+++ b/src-tauri/addons/widgets/example/widget.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+ Widget Example
+
+
+ Example
+
+
+
+
\ No newline at end of file
diff --git a/src-tauri/addons/widgets/example/widget.js b/src-tauri/addons/widgets/example/widget.js
new file mode 100644
index 0000000..4ad2a8d
--- /dev/null
+++ b/src-tauri/addons/widgets/example/widget.js
@@ -0,0 +1,8 @@
+// make this js file as a module
+import { listen } from "@tauri-apps/api/event";
+
+listen('heart-rate', event => {
+ console.log('Heart rate:', event.payload)
+})
+
+export {}
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index c929920..ba67247 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -16,6 +16,14 @@
"all": false,
"open": true
},
+ "fs": {
+ "scope": [
+ "$RESOURCE/*"
+ ]
+ },
+ "path": {
+ "all": true
+ },
"window": {
"all": false,
"close": true,
@@ -25,7 +33,8 @@
"minimize": true,
"unmaximize": true,
"unminimize": true,
- "startDragging": true
+ "startDragging": true,
+ "create": true
},
"dialog": {
"all": true
@@ -42,7 +51,16 @@
}
],
"security": {
- "csp": null
+ "csp": "default-src 'self' file://*",
+ "dangerousRemoteDomainIpcAccess": [
+ {
+ "domain": "file://*",
+ "enableTauriAPI": true,
+ "windows": [
+ "widget_example"
+ ]
+ }
+ ]
},
"bundle": {
"active": true,
@@ -53,6 +71,9 @@
"category": "Utility",
"shortDescription": "HBCat",
"longDescription": "Catch your heartbeat",
+ "resources": [
+ "addons/*"
+ ],
"icon": [
"icons/icon.ico"
],
diff --git a/src/pages/widgets.vue b/src/pages/widgets.vue
index 4cba832..13618bf 100644
--- a/src/pages/widgets.vue
+++ b/src/pages/widgets.vue
@@ -1,11 +1,31 @@
- 前面的区域,以后再来探索吧!
+