about summary refs log tree commit diff
path: root/src/state/index.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-10-03 10:53:36 -0500
committerPaul Frazee <pfrazee@gmail.com>2022-10-03 10:53:36 -0500
commitc7d7e152a0e067a95b3d700147768d4244e464d1 (patch)
tree091b1a22f4fb7ff451976a3fbf806fbff859adab /src/state/index.ts
parentb05a334dcbd6fbc5eb59da1d5cb111f683d5b1d8 (diff)
downloadvoidsky-c7d7e152a0e067a95b3d700147768d4244e464d1.tar.zst
Implement notifications
Diffstat (limited to 'src/state/index.ts')
-rw-r--r--src/state/index.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/state/index.ts b/src/state/index.ts
index 07a15f56a..12b3ff181 100644
--- a/src/state/index.ts
+++ b/src/state/index.ts
@@ -9,6 +9,7 @@ import {ShellModel} from './models/shell'
 
 const ROOT_STATE_STORAGE_KEY = 'root'
 const DEFAULT_SERVICE = 'http://localhost:2583'
+const STATE_FETCH_INTERVAL = 15e3
 
 export async function setupState() {
   let rootStore: RootStoreModel
@@ -32,8 +33,14 @@ export async function setupState() {
   })
 
   await rootStore.session.setup()
+  await rootStore.fetchStateUpdate()
   console.log(rootStore.me)
 
+  // periodic state fetch
+  setInterval(() => {
+    rootStore.fetchStateUpdate()
+  }, STATE_FETCH_INTERVAL)
+
   return rootStore
 }