summary refs log tree commit diff
path: root/lib/stores.js
blob: eacb5e24aca690dee6b25bf3df9c36577b59e88e (plain)
1
2
3
4
5
6
7
8
9
10
11
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;
}