(all o)
Tell realized map to capture all output of the observable, not just the last one
Tell realized map to capture all output of the observable, not just the last one
(let-realized bindings & body)
EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION
'let' version of realized map.
(let-realized [a (make-observable)] (* 2 a))
is equivalent to:
(->> (realized-map :a (make-observable)) (map (fn [{:keys [a]}] (* 2 a))))
That is, it eliminates the repition of the map keys when you want to do something with the final result.
Evaluates to an Observable that emits the value of the let body.
See: rx.lang.clojure.realized/realized-map rx.lang.clojure.realized/all
EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION 'let' version of realized map. (let-realized [a (make-observable)] (* 2 a)) is equivalent to: (->> (realized-map :a (make-observable)) (map (fn [{:keys [a]}] (* 2 a)))) That is, it eliminates the repition of the map keys when you want to do something with the final result. Evaluates to an Observable that emits the value of the let body. See: rx.lang.clojure.realized/realized-map rx.lang.clojure.realized/all
(only o)
Tell realized map to capture the only value emitted by the observable. If there are 0 or more than one values, an IllegalStateException is thrown which should propagate to onError.
This is the default mode of realized-map and let-realized.
Tell realized map to capture the only value emitted by the observable. If there are 0 or more than one values, an IllegalStateException is thrown which should propagate to onError. This is the default mode of realized-map and let-realized.
(realized-map & keyvals)
EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION
See let-realized.
Given a map from key to observable, returns an observable that emits a single map from the same keys to the values emitted by their corresponding observable.
keyvals is a list of key/value pairs where key is a key in the emitted map and val can be one of the following:
rx.Observable The only value of the emitted sequence is bound to the key. This is the default since this is often a singleton response from a request. If the Observable produces 0 or more than 1 values, an IllegalStateException is produced.
vector The first element of the vector must be an Observable. Remaining elements are functions applied in sequence to the list of values emitted by the observable. For example [my-observable first] will result in a single value in the emitted map rather than a vector of values.
other The value is placed in the emitted map as is
Note the observable can also be wrapped with realized/all to get the full list rather than just the last value.
The purpose of this is to simplify the messy pattern of mapping observables to single key maps, merging and then folding all the separate maps together. So code like this:
; TODO update (->> (rx/merge (->> (user-info-o user-id) (rx/map (fn [u] {:user u}))) (->> (user-likes-o user-id) (rx/map (fn [u] {:likes u})))) (rx/reduce merge {}))
becomes:
(realized-map :user (user-info-o user-id) :likes (user-likes-o user-id))
See: let-realized
EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION See let-realized. Given a map from key to observable, returns an observable that emits a single map from the same keys to the values emitted by their corresponding observable. keyvals is a list of key/value pairs where key is a key in the emitted map and val can be one of the following: rx.Observable The only value of the emitted sequence is bound to the key. This is the default since this is often a singleton response from a request. If the Observable produces 0 or more than 1 values, an IllegalStateException is produced. vector The first element of the vector must be an Observable. Remaining elements are functions applied in sequence to the list of values emitted by the observable. For example [my-observable first] will result in a single value in the emitted map rather than a vector of values. other The value is placed in the emitted map as is Note the observable can also be wrapped with realized/all to get the full list rather than just the last value. The purpose of this is to simplify the messy pattern of mapping observables to single key maps, merging and then folding all the separate maps together. So code like this: ; TODO update (->> (rx/merge (->> (user-info-o user-id) (rx/map (fn [u] {:user u}))) (->> (user-likes-o user-id) (rx/map (fn [u] {:likes u})))) (rx/reduce merge {})) becomes: (realized-map :user (user-info-o user-id) :likes (user-likes-o user-id)) See: let-realized
(realized-map* map-description)
EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION
Same as realized-map, but takes a map argument rather than key-value pairs.
EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION Same as realized-map, but takes a map argument rather than key-value pairs.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close