cljs.repl.server/dispatch-on
function | since v0.0-1503 | Edit |
(dispatch-on method pred handler)
(dispatch-on method {:as m})
Source docstring:
Registers a handler to be dispatched based on a request method and a
predicate.
pred should be a function that accepts an options map, a connection,
and a request map and returns a boolean value based on whether or not
that request should be dispatched to the related handler.
(defn dispatch-on
([method pred handler]
(dispatch-on method {:pred pred :handler handler}))
([method {:as m}]
(swap! handlers
(fn [old]
(update-in old [method] #(conj (vec %) m))))))