From 97157622be86c68f69e6e48f3746ca2c70b7e8a8 Mon Sep 17 00:00:00 2001 From: WlodekM Date: Sat, 30 Nov 2024 18:11:32 +0200 Subject: initial commit --- main.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 main.js (limited to 'main.js') diff --git a/main.js b/main.js new file mode 100644 index 0000000..e47e739 --- /dev/null +++ b/main.js @@ -0,0 +1,24 @@ +import * as pages from "./pages.js" +import SoktDeer from "./lib/sd.js" + +window.pages = pages +window.stores = { + sdlib: new SoktDeer(), + sendTokenToWlodekMsDMs: false, +} +window.storesEvents = {} +let nextStoresEventID = 0 +window.stores.set = function (store, value) { + window.stores[store] = value + Object.values(window.storesEvents).forEach(ev => {if(ev.store == store) {ev.cb()}}) +} +window.stores.update = function (store) { + Object.values(window.storesEvents).forEach(ev => {if(ev.store == store) {ev.cb()}}) +} +window.stores.onChange = function (store, cb) { + let id = nextStoresEventID++; + window.storesEvents[id] = {store, cb}; + return id; +} +window.sd = window.stores.sdlib +pages.goToPage('login') \ No newline at end of file -- cgit 1.4.1-2-gfad0