diff options
author | WlodekM <[email protected]> | 2024-11-30 18:11:32 +0200 |
---|---|---|
committer | WlodekM <[email protected]> | 2024-11-30 18:11:32 +0200 |
commit | 97157622be86c68f69e6e48f3746ca2c70b7e8a8 (patch) | |
tree | 32fe8069343d2b41f01b2d58325942fb43864056 /main.js |
initial commit
Diffstat (limited to 'main.js')
-rw-r--r-- | main.js | 24 |
1 files changed, 24 insertions, 0 deletions
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 |