(reset-vals! a new-value)
Sets the value of atom to newval. Returns [old new], the value of the
atom before and after the reset.
Source
(defn
reset-vals!
"Sets the value of atom to newval. Returns [old new], the value of the\n atom before and after the reset."
{:added "1.9"}
[a new-value]
(let
[validate (.-validator a)]
(when-not
(nil? validate)
(when-not
(validate new-value)
(throw (js/Error. "Validator rejected reference state"))))
(let
[old-value (.-state a)]
(set! (.-state a) new-value)
(when-not
(nil? (.-watches a))
(-notify-watches a old-value new-value))
[old-value new-value])))