(dispatch ref f & args)
Updates the value contained within a container using another thread.
(def res (state/dispatch (atom 0) (fn [x] (inc x)))) res => future? @res => atom? @@res => 1
Updates the value contained within a container using another thread. (def res (state/dispatch (atom 0) (fn [x] (inc x)))) res => future? @res => atom? @@res => 1
(empty obj)
(empty obj opts)
empties the state, extensible through the IStateSet protocol (let [a (atom 1)] (state/empty a) @a) => nil
empties the state, extensible through the IStateSet protocol (let [a (atom 1)] (state/empty a) @a) => nil
(get obj)
(get obj opts)
Like deref but is extensible through the IStateGet protocol
(state/get (atom 1)) => 1
(state/get (ref 1)) => 1
Like deref but is extensible through the IStateGet protocol (state/get (atom 1)) => 1 (state/get (ref 1)) => 1
(set obj v)
(set obj opts v)
Like reset! but is extensible through the IStateSet protocol
(let [a (atom nil)] (state/set a 1) @a) => 1
Like reset! but is extensible through the IStateSet protocol (let [a (atom nil)] (state/set a 1) @a) => 1
(update obj f)
(update obj opts? f & args)
Like swap! but is extensible through the IStateSet protocol
(let [a (atom 0)] (state/update a + 1) @a) => 1
Like swap! but is extensible through the IStateSet protocol (let [a (atom 0)] (state/update a + 1) @a) => 1
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close