Tensegritics / ClojureDart

Clojure dialect for Flutter and Dart
1.44k stars 91 forks source link

Support multiple bindings in `:bg-watcher` #285

Open cgrand opened 1 year ago

cgrand commented 1 year ago

Currently :bg-watcher only allows for one binding: it can only listen to one stream/etc. This creates the need for utilities (like switchmap) to compose a single stream so as to consume it with :bg-watcher.

Here I propose allowing multiple bindings in :bg-watcher

[a-binding a-expr
 b-binding b-expr]

the semantics are that each time we get new values from a, we unsubscribe and resubscribe to b-expr. This would be similar to switchmap. In fact we would need a composite ISubscribable for that.

Additionally I believe it would be beneficial to allow :let [...] after binding pairs (and their options).