This library aims to bring some of the functionality re-frame provides on the client side to the server side.
re-frame is a functional framework for writing SPAs in ClojureScript, using Reganet.
re-serve is functional framework for writing server side applications with long-living connections to the clients. It re-uses the internals of re-frame and runs on Clojure instead of ClojureScript. The API is kept as close to re-frame's API as possible.
core.async
, you can handle any message in a core.async channel as an event.You can find examples in the examples directory under the code.
Add
[re-frame "0.1.0"]
to your dependencies.
Require [re-frame.core :as re-frame]
where it is needed.
#####(start-session & {:keys [teardown-event]})
Start and return a re-serve session with an empty db. It takes an optional teardown-event
which dispatched as the last event after the termination of the session.
#####(stop-session session)
Terminate the re-serve session.
#####(dispatch session event)
Dispatche the event
vector on the gives session
.
#####(dispatch-sync session event)
The same as the previous dispatch call, but it waits until the event
is enqueued for processing.
#####(reg-fx id handler)
Register an effect handler
for the given id
.
#####(clear-fx id)
Clear an effect registration.
#####(reg-fx-session id handler)
Register an effect handler
for the given id
. The effect handlers got the session-context as the first parameter and need to return with the updated session-context. Only for experimental usage.
#####:attach {:keys [chan dispatch]}
Attache a core.async
channel to the session. That means dispatch event will be dispatched when there is a message available on the chan.
#####:detach chan
Detache the channel from the session.
#####:stop-session _
Stop the session.
#####(reg-cofx id handler)
Register a new coeffects.
#####(inject-cofx id) (inject-cofx id value)
Create an interceptor from the previously registered coeffect.
#####(clear-cofx id)
Clear a coeffect registration.
#####(reg-event-db id handler) (reg-event-db id interceptors handler)
Register the given event handler function for the given event id.
handler is a function: (db event) -> db.
#####(reg-event-fx id handler) (reg-event-fx id interceptors handler)
Register the given event handler function for the given event id.
handler is a function: (coeffects-map event-vector) -> effects-map.
#####(reg-event-ctx id handler) (reg-event-ctx id interceptors handler)
Register the given event handler function for the given event id.
handler is a function: (context-map event-vector) -> context-map.
Copyright © 2019
done by kotyo
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close