reset!

functionsince v0.0-927 clojure.core/reset!Edit
(reset! a new-value)

Details:

Sets the value of atom a to new-value without regard for the current value.

Returns new-value.


See Also:


Source docstring:
Sets the value of atom to newval without regard for the
current value. Returns new-value.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn reset!
  [a new-value]
  (if (instance? Atom a)
    (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))
        new-value))
    (-reset! a new-value)))