aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/plugins
diff options
context:
space:
mode:
authorRemy Raes <raes.remy@gmail.com>2022-09-24 13:02:12 +0200
committerRemy Raes <raes.remy@gmail.com>2022-09-24 13:02:12 +0200
commit9635801759facbfdc3c033f70a64ae4635be19f6 (patch)
tree605be2d44f86728a110ca5a2d135f1c1e183018d /src-vue/src/plugins
parente1271d73a67ecc711838e8e8c37bd20d9fe019fc (diff)
downloadFlightCore-9635801759facbfdc3c033f70a64ae4635be19f6.tar.gz
FlightCore-9635801759facbfdc3c033f70a64ae4635be19f6.zip
feat: listen to origin/northstar events
Diffstat (limited to 'src-vue/src/plugins')
-rw-r--r--src-vue/src/plugins/store.ts26
1 files changed, 23 insertions, 3 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts
index 94464e3c..551f279e 100644
--- a/src-vue/src/plugins/store.ts
+++ b/src-vue/src/plugins/store.ts
@@ -1,10 +1,30 @@
import { createStore } from 'vuex';
+import { listen, Event as TauriEvent } from "@tauri-apps/api/event";
export const store = createStore({
state () {
return {
- installed_northstar_version: "1.9.7"
+ installed_northstar_version: "1.9.7",
+
+ northstar_is_running: false,
+ origin_is_running: false
}
},
- mutations: {}
-}); \ No newline at end of file
+ mutations: {
+ initializeListeners(state) {
+ _initializeListeners(state);
+ }
+ }
+});
+
+function _initializeListeners(state: any) {
+ listen("origin-running-ping", function (evt: TauriEvent<any>) {
+ state.origin_is_running = evt.payload as boolean;
+ console.log(`Origin is running: ${evt.payload}`);
+ });
+
+ listen("northstar-running-ping", function (evt: TauriEvent<any>) {
+ state.northstar_is_running = evt.payload as boolean;
+ console.log(`Northstar is running: ${evt.payload}`);
+ });
+} \ No newline at end of file