Liking cljdoc? Tell your friends :D

keechma.app-state


add-sub-cachecljs

(add-sub-cache cache [key sub])
source

app-renderercljs

(app-renderer state)
source

AppStatecljs

source

AppStateWriteHandlercljs

source

ControllerWriteHandlercljs

source

default-route-processorcljs

(default-route-processor route _)
source

deserialize-app-statecljs

(deserialize-app-state transit-readers serialized-state)
source

get-controller-types-setcljs

(get-controller-types-set app-state)
source

get-initial-datacljs

(get-initial-data config)
source

prepare-for-serializationcljs

(prepare-for-serialization value)
(prepare-for-serialization value controller-types)
source

restore-app-dbcljs

(restore-app-db old-app new-app)
source

run-lifecycle-fnscljs

(run-lifecycle-fns lifecycle config)
source

serialize-app-statecljs

(serialize-app-state transit-writers state)
source

SerializedAppStatecljs

source

start!cljs

(start! config)
(start! config should-mount?)

Starts the application. It receives the application config map as the first argument. It receives boolean should-mount? as the second element. Default value for should-mount? is true.

You can pass false to the should-mount? argument if you want to start the app, but you want to manually mount the application (for instance another app could manage mounting and unmounting). In that case you can get the main app component at the :main-component of the map returned from the start! function.

Application config contains all the parts needed to run the application:

  • Route defintions
  • Controllers
  • UI subscriptions
  • UI components
  • HTML element to which the component should be mounted
  • Routes chan (through which the route changes will be communicated)
  • Commands chan (through which the UI sends the commands to the controllers)

start! function returns the updated config map which can be passed to the stop! function to stop the application.

Example:

(def app-config {:controllers {:users (->users/Controller)}
                 :subscriptions {:user-list (fn [app-db-atom])}
                 :components {:main layout/component
                              :users users/component}
                 :html-element (.getElementById js/document "app")})

If any of the params is missing, the defaults will be used.

When the application is started, the following happens:

  1. Routes are expanded (converted to regexps, etc.)
  2. Application binds the listener the history change event
  3. Controller manager is started
  4. Application is (optionally) mounted into the DOM
Starts the application. It receives the application config `map` as the first argument.
It receives `boolean` `should-mount?` as the second element. Default value for `should-mount?`
is `true`.

You can pass false to the `should-mount?` argument if you want to start the app,
but you want to manually mount the application (for instance another app could manage mounting
and unmounting). In that case you can get the main app component at the `:main-component` of the
map returned from the `start!` function.

Application config contains all the parts needed to run the application:

- Route defintions
- Controllers
- UI subscriptions
- UI components 
- HTML element to which the component should be mounted
- Routes chan (through which the route changes will be communicated)
- Commands chan (through which the UI sends the commands to the controllers)

`start!` function returns the updated config map which can be passed to the `stop!`
function to stop the application.

Example:

```clojure
(def app-config {:controllers {:users (->users/Controller)}
                 :subscriptions {:user-list (fn [app-db-atom])}
                 :components {:main layout/component
                              :users users/component}
                 :html-element (.getElementById js/document "app")})
```

If any of the params is missing, the defaults will be used.

When the application is started, the following happens:

1. Routes are expanded (converted to regexps, etc.)
2. Application binds the listener the history change event
3. Controller manager is started
4. Application is (optionally) mounted into the DOM

sourceraw docstring

start-router!cljs

(start-router! state)
source

start-selected-router!cljs

(start-selected-router! state constructor)
source

stop!cljs

(stop! config)
(stop! config done)

Stops the application. stop! function receives the following as the arguments:

  • config - App config map returned from the start! function
  • done - An optional callback function that will be called when the application is stopped.

Purpose of the stop! function is to completely clean up after the application. When the application is stopped, the following happens:

  1. History change event listener is unbound
  2. Controller manager and any running controllers are stopped
  3. Any channels used by the app (routes-chan, commands-chan,...) are closed
  4. Application is unmounted and removed from the DOM
Stops the application. `stop!` function receives the following as the arguments:

- `config` - App config map returned from the `start!` function
- `done` - An optional callback function that will be called when the application
is stopped.

Purpose of the `stop!` function is to completely clean up after the application. When the
application is stopped, the following happens:

1. History change event listener is unbound
2. Controller manager and any running controllers are stopped
3. Any channels used by the app (`routes-chan`, `commands-chan`,...) are closed
4. Application is unmounted and removed from the DOM
sourceraw docstring

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

× close