diff options
Diffstat (limited to 'src-vue/src/plugins')
-rw-r--r-- | src-vue/src/plugins/store.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts new file mode 100644 index 00000000..226adafe --- /dev/null +++ b/src-vue/src/plugins/store.ts @@ -0,0 +1,35 @@ +import { createStore } from 'vuex'; +import { listen, Event as TauriEvent } from "@tauri-apps/api/event"; + +export const store = createStore({ + state () { + return { + developer_mode: false, + + installed_northstar_version: "1.9.7", + + northstar_is_running: false, + origin_is_running: false + } + }, + mutations: { + toggleDeveloperMode(state) { + state.developer_mode = !state.developer_mode; + }, + 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 |