Liking cljdoc? Tell your friends :D

kee-frame.core


debug-enabled?clj/s

(debug-enabled?)
source

extra-optionsclj/s

(extra-options options)

Complete listing of invalid options sent to the start! function.

Complete listing of invalid options sent to the `start!` function.
sourceraw docstring

kee-frame-interceptorsclj/s

source

path-forclj/s

(path-for handler & params)

Make a uri from route data. Useful for avoiding hard coded links in your app.

Parameters:

handler: The reitit handler from route data

params: Reitit route params for the requested route

Usage: [:a {:href (k/path-for [:orders :sort-by :date]} "Orders sorted by date"]

Make a uri from route data. Useful for avoiding hard coded links in your app.

Parameters:

`handler`: The reitit handler from route data

`params`: Reitit route params for the requested route

Usage: `[:a {:href (k/path-for [:orders :sort-by :date]} "Orders sorted by date"]`
sourceraw docstring

reg-chainclj/s

(reg-chain id & handlers)

Register a list of re-frame fx handlers, chained together.

The chaining is done through dispatch inference. https://github.com/Day8/re-frame-http-fx is supported by default, you can easily add your own like this: https://github.com/ingesolvoll/kee-frame#configuring-chains-since-020.

Each handler's event vector is prepended with accumulated event vectors of previous handlers. So if the first handler receives [a b], and the second handler normally would receive [c], it will actually receive [a b c]. The purpose is to make all context available to the entire chain, without a complex framework or crazy scope tricks.

Parameters:

id: the id of the first re-frame event. The next events in the chain will get the same id followed by an index, so if your id is add-todo, the next one in chain will be called add-todo-1.

handlers: re-frame event handler functions, registered with kee-frame.core/reg-event-fx.

Usage:

(k/reg-chain
  :load-customer-data

  (fn [ctx [customer-id]]
    {:http-xhrio {:uri    (str "/customer/" customer-id)
                  :method :get}})

  (fn [cxt [customer-id customer-data]
    (assoc-in ctx [:db :customers customer-id] customer-data)))
Register a list of re-frame fx handlers, chained together.

The chaining is done through dispatch inference. https://github.com/Day8/re-frame-http-fx is supported by default,
you can easily add your own like this: https://github.com/ingesolvoll/kee-frame#configuring-chains-since-020.

Each handler's event vector is prepended with accumulated event vectors of previous handlers. So if the first handler
receives [a b], and the second handler normally would receive [c], it will actually receive [a b c]. The purpose is
to make all context available to the entire chain, without a complex framework or crazy scope tricks.

Parameters:

`id`: the id of the first re-frame event. The next events in the chain will get the same id followed by an index, so
if your id is `add-todo`, the next one in chain will be called `add-todo-1`.

`handlers`: re-frame event handler functions, registered with `kee-frame.core/reg-event-fx`.


Usage:
```
(k/reg-chain
  :load-customer-data

  (fn [ctx [customer-id]]
    {:http-xhrio {:uri    (str "/customer/" customer-id)
                  :method :get}})

  (fn [cxt [customer-id customer-data]
    (assoc-in ctx [:db :customers customer-id] customer-data)))
```
sourceraw docstring

reg-chain-namedclj/s

(reg-chain-named & handlers)

Same as reg-chain, but with manually named event handlers. Useful when you need more meaningful names in your event log.

Parameters:

handlers: pairs of id and event handler.

Usage:

(k/reg-chain-named

  :load-customer-data
  (fn [ctx [customer-id]]
    {:http-xhrio {:uri "..."}})

  :receive-customer-data
   (fn [ctx [customer-id customer-data]]
    (assoc-in ctx [:db :customers customer-id] customer-data)))
Same as `reg-chain`, but with manually named event handlers. Useful when you need more meaningful names in your
event log.

Parameters:

`handlers`: pairs of id and event handler.

Usage:
```
(k/reg-chain-named

  :load-customer-data
  (fn [ctx [customer-id]]
    {:http-xhrio {:uri "..."}})

  :receive-customer-data
   (fn [ctx [customer-id customer-data]]
    (assoc-in ctx [:db :customers customer-id] customer-data)))
```
sourceraw docstring

reg-controllerclj/s

(reg-controller id controller)

Put a controller config map into the global controller registry.

Parameters:

id: Must be unique in controllere registry. Will appear in logs.

controller: A map with the following keys:

  • :params: A function that receives the route data and returns the part that should be sent to the start function. A nil return means that the controller should not run for this route.

  • :start: A function or an event vector. Called when params returns a non-nil value different from the previous invocation. The function receives whatever non-nil value that was returned from params, and returns a re-frame event vector. If the function does nothing but returning the vector, the surrounding function can be omitted.

  • :stop: Optional. A function or an event vector. Called when previous invocation of params returned non-nil and the current invocation returned nil. If the function does nothing but returning the vector, the surrounding function can be omitted.

Put a controller config map into the global controller registry.

Parameters:

`id`: Must be unique in controllere registry. Will appear in logs.

`controller`: A map with the following keys:
- `:params`: A function that receives the route data and returns the part that should be sent to the `start` function. A nil
return means that the controller should not run for this route.

- `:start`: A function or an event vector. Called when `params` returns a non-nil value different from the previous
invocation. The function receives whatever non-nil value that was returned from `params`,
and returns a re-frame event vector. If the function does nothing but returning the vector, the surrounding function
can be omitted.

- `:stop`: Optional. A function or an event vector. Called when previous invocation of `params` returned non-nil and the
current invocation returned nil. If the function does nothing but returning the vector, the surrounding function
can be omitted.
sourceraw docstring

reg-event-dbclj/s

(reg-event-db id handler)
(reg-event-db id interceptors handler)

Exactly same signature as re-frame.core/reg-event-db. Use this version if you want kee-frame logging and spec validation.

re-frame.core/trim-v interceptor is also applied.

Exactly same signature as `re-frame.core/reg-event-db`. Use this version if you want kee-frame logging and spec validation.

`re-frame.core/trim-v` interceptor is also applied.
sourceraw docstring

reg-event-fxclj/s

(reg-event-fx id handler)
(reg-event-fx id interceptors handler)

Exactly same signature as re-frame.core/reg-event-fx. Use this version if you want kee-frame logging and spec validation.

re-frame.core/trim-v interceptor is also applied.

Exactly same signature as `re-frame.core/reg-event-fx`. Use this version if you want kee-frame logging and spec validation.

`re-frame.core/trim-v` interceptor is also applied.
sourceraw docstring

start!clj/s

(start! options)

Starts your client application with the specified options.

This function is intentionally forgiving in certain ways:

  • You can call it as often as you want. Figwheel should call it on each code change
  • You can omit the options altogether. kee-frame chooses sensible defaults for you and leads the way.

Usage:

(k/start! {:debug?         true
           :routes         my-reitit-routes
           :hash-routing?  true
           :initial-db     {:some-property "default value"}
           :root-component [my-reagent-root-component]
           :app-db-spec    :spec/my-db-spec})
Starts your client application with the specified `options`.

This function is intentionally forgiving in certain ways:
- You can call it as often as you want. Figwheel should call it on each code change
- You can omit the `options` altogether. kee-frame chooses sensible defaults for you and leads the way.

Usage:
```
(k/start! {:debug?         true
           :routes         my-reitit-routes
           :hash-routing?  true
           :initial-db     {:some-property "default value"}
           :root-component [my-reagent-root-component]
           :app-db-spec    :spec/my-db-spec})
```
sourceraw docstring

switch-routeclj/s

(switch-route f & pairs)

Reagent component that renders different components for different routes.

You might need to include a case for nil, since there are no route data before the first navigation.

Parameters:

f: A function that receives the route data on every route change, and returns the value to dispatch on.

pairs: A pair consists of the dispatch value and the reagent component to dispatch to.

Returns the first component with a matching dispatch value.

Usage:

[k/switch-route (fn [route] (:handler route))
  :index [:div "This is index page"]
  :about [:div "This is the about page"]
  nil    [:div "Probably also the index page"]]
Reagent component that renders different components for different routes.

You might need to include a case for `nil`, since there are no route data before the first navigation.

Parameters:

`f`: A function that receives the route data on every route change, and returns the value to dispatch on.

`pairs`: A pair consists of the dispatch value and the reagent component to dispatch to.

Returns the first component with a matching dispatch value.

Usage:
```
[k/switch-route (fn [route] (:handler route))
  :index [:div "This is index page"]
  :about [:div "This is the about page"]
  nil    [:div "Probably also the index page"]]
```
sourceraw docstring

valid-option-key?clj/s

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close