(prepare-for-serialization value)
(prepare-for-serialization value controller-types)
(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:
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:
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
(stop! config)
(stop! config done)
Stops the application. stop!
function receives the following as the arguments:
config
- App config map returned from the start!
functiondone
- 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:
routes-chan
, commands-chan
,...) are closedStops 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
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close