cljs.repl.server/dispatch-on

functionsince v0.0-1503Edit
(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.
Source code @ clojurescript:src/main/clojure/cljs/repl/server.clj
(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))))))