robert-hooke icon indicating copy to clipboard operation
robert-hooke copied to clipboard

Isn't `clear-hooks` redundant?

Open kindlychung opened this issue 9 years ago • 0 comments

Isn't clear-hooks redundant? Eventually all hooks are cleared anyways.

(defn- clear-hook-mechanism [target-var]
  (alter-var-root target-var
                  (constantly (original target-var))))



(defn clear-hooks
  "Remove all hooks from target-var."
  [target-var]
  (when-let [hooks (hooks target-var)]
    (swap! hooks empty)
    (clear-hook-mechanism target-var)))

kindlychung avatar May 13 '15 17:05 kindlychung