aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-vue/src/App.vue15
-rw-r--r--src-vue/src/plugins/store.ts26
2 files changed, 37 insertions, 4 deletions
diff --git a/src-vue/src/App.vue b/src-vue/src/App.vue
index 70afd62c..06499058 100644
--- a/src-vue/src/App.vue
+++ b/src-vue/src/App.vue
@@ -1,6 +1,19 @@
-<script setup lang="ts">
+<script lang="ts">
import PlayView from './views/PlayView.vue';
import { appWindow } from '@tauri-apps/api/window';
+import { store } from './plugins/store';
+
+export default {
+ components: {
+ PlayView
+ },
+ data() {
+ return {}
+ },
+ mounted: () => {
+ store.commit('initializeListeners');
+ }
+}
</script>
<template>
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