remove-watch

functionsince v0.0-927 clojure.core/remove-watchEdit
(remove-watch iref key)

Details:

Removes a watch function identified by key from atom a. The function must have originally been set by add-watch.


Examples:

(def a (atom {}))

(add-watch a :logger
  (fn [_key _atom old-state new-state]
    (println "old:" old-state)
    (println "new:" new-state)))

(swap! a assoc :foo "bar")
;;=> will print the following:
;; old: {}
;; new: {:foo "bar"}

(remove-watch a :logger)

(swap! a assoc :foo 3)
;;=> nothing will be printed...

See Also:


Source docstring:
Removes a watch (set by add-watch) from a reference
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn remove-watch
  [iref key]
  (-remove-watch iref key)
  iref)