Fx/CoFX for EventSource objects
Fx/CoFX for EventSource objects
(close! {es :event-source ?on-close :on-close :as es-map})Given an event source wrapper map, close it and run a callback if present
Given an event source wrapper map, close it and run a callback if present
(close-fx {:keys [keys handle-done]})An fx handler that shuts down one or all event sources. handle-done is a partial event vector that will be dispatched with the state of the event-sources map before and after.
An fx handler that shuts down one or all event sources. handle-done is a partial event vector that will be dispatched with the state of the event-sources map before and after.
(event-source-error error-map & [?cause])Wrap event source errors.
Wrap event source errors.
(get-cofx cofx keys)A cofx handler that gets all or a particular set of event sources
A cofx handler that gets all or a particular set of event sources
(init-fx {:keys [uri key handle-open handle-message handle-error handle-close
                 event-source-args]
          :as arg-map})Fx handler to initialize an event source that talks back to re-frame. EventSources are stored in a map by their key, which can be a URI or explicit value. handle-* args are partial event dispatch vectors that will be called with the key/uri and the event source itself (or message).
Fx handler to initialize an event source that talks back to re-frame. EventSources are stored in a map by their key, which can be a URI or explicit value. handle-* args are partial event dispatch vectors that will be called with the key/uri and the event source itself (or message).
(new-event-source
  {:keys [uri on-open on-message on-error config decode-msg-fn]
   :or {config {}
        decode-msg-fn (fn [e] (some-> e .-data not-empty codec/decode-string))
        on-open (fn [e]
                    (.debug js/console "Unhandled Event Source Open Event" e))
        on-message
          (fn [e] (.debug js/console "Unhandled EventSource Message Event" e))
        on-error (fn [e] (.error js/console "Unhandled EventSource Error" e))}})Create a new event source, with optional handlers for open, message, error. By default, messages are transit decoded, but you can change this by setting decode-msg-fn to false or replacing it with something.
Create a new event source, with optional handlers for open, message, error. By default, messages are transit decoded, but you can change this by setting decode-msg-fn to false or replacing it with something.
(register!)Register fx/cofx for event sources
Register fx/cofx for event sources
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |