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 /lib/stores.js |
initial commit
Diffstat (limited to 'lib/stores.js')
-rw-r--r-- | lib/stores.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/stores.js b/lib/stores.js new file mode 100644 index 0000000..eacb5e2 --- /dev/null +++ b/lib/stores.js @@ -0,0 +1,12 @@ +export function set(store, value) { + window.stores[store] = value + Object.values(window.storesEvents).forEach(ev => {if(ev.store == store) cb()}) +} +export function update(store) { + Object.values(window.storesEvents).forEach(ev => {if(ev.store == store) cb()}) +} +export function onChange(store, cb) { + let id = nextStoresEventID++; + storesEvents[id] = {store, cb}; + return id; +} \ No newline at end of file |