robert-hooke
robert-hooke copied to clipboard
Isn't `clear-hooks` redundant?
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)))