cefn / watchable

Repo for @watchable/store and supporting packages.
MIT License
5 stars 1 forks source link

Emulate nanostores listen vs subscribe #23

Open cefn opened 1 year ago

cefn commented 1 year ago

I just found nanostores which has a lot in common with our store implementation.

One improvement is the ability to trigger a callback at the same time as watching...

In nanostores const store.subscribe(cb) passes the current state to cb while const store.listen(cb) just watches.

In our store, this could be achieved in a minor version (backward compatible) with a second boolean argument to watch, although this prevents potentially multiple watchers being passed as an argument, which is an alternative signature.