(latch primary follower)
(latch primary follower f)
(latch primary follower f opts)
Followes two irefs together so that when primary
changes, the follower
will also be updated.
(def primary (atom 1)) (def follower (atom nil))
(latch primary follower #(* 10 %)) (swap! primary inc)
@primary => 2 @follower => 20
Followes two irefs together so that when `primary` changes, the `follower` will also be updated. (def primary (atom 1)) (def follower (atom nil)) (latch primary follower #(* 10 %)) (swap! primary inc) @primary => 2 @follower => 20
(unlatch primary follower)
Removes the latch so that updates will not be propagated
(def primary (atom 1)) (def follower (atom nil))
(latch primary follower) (swap! primary inc) @primary => 2 @follower => 2
(unlatch primary follower) (swap! primary inc) @primary => 3 @follower => 2
Removes the latch so that updates will not be propagated (def primary (atom 1)) (def follower (atom nil)) (latch primary follower) (swap! primary inc) @primary => 2 @follower => 2 (unlatch primary follower) (swap! primary inc) @primary => 3 @follower => 2
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close