(comp-middleware v)
Given a vector of middleware, filter out any nils, and use "comp" to compose them. v can have nested vectors, and will be flattended before "comp" is applied. For convienience, if v turns out to already be a function (assumed to be middleware), just return it. Filtering out nils allows us to create Middlewhere conditionally like this: (comp-middleware [pure (when debug? debug)]) ;; that 'when' might leave a nil
Given a vector of middleware, filter out any nils, and use "comp" to compose them. v can have nested vectors, and will be flattended before "comp" is applied. For convienience, if v turns out to already be a function (assumed to be middleware), just return it. Filtering out nils allows us to create Middlewhere conditionally like this: (comp-middleware [pure (when debug? debug)]) ;; that 'when' might leave a nil
(dispatch event-v)
Send an event to be processed by the registered handler.
Usage example: (dispatch [:delete-item 42])
Send an event to be processed by the registered handler. Usage example: (dispatch [:delete-item 42])
(dispatch-sync event-v)
Invoke the event handler sycronously, avoiding the async-inducing use of core.async/chan
Invoke the event handler sycronously, avoiding the async-inducing use of core.async/chan
(handle event-v)
Given an event vector, look up the right handler, then call it. By default, handlers are not assumed to be pure. They are called with two paramters:
app-db
atom andGiven an event vector, look up the right handler, then call it. By default, handlers are not assumed to be pure. They are called with two paramters: - the `app-db` atom and - the event vector The handler is assumed to side-effect on the atom, the return value is ignored. To write pure handlers, use the "pure" middleware when registering the handler.
(register event-id handler-fn)
(register event-id middleware handler-fn)
register a handler for an event
register a handler for an event
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close