Liking cljdoc? Tell your friends :D

keechma.controller-manager


apply-route-changecljs

(apply-route-change reporter route-params app-db-atom commands-chan controllers)
source

apply-start-controllerscljs

source

apply-start-or-wake-controllerscljs

(apply-start-or-wake-controllers action
                                 reporter-action
                                 app-db
                                 reporter
                                 controllers
                                 commands-chan
                                 get-running
                                 active-topics
                                 start-or-wake)
source

apply-stop-controllerscljs

(apply-stop-controllers app-db reporter stop)
source

apply-wake-controllerscljs

source

call-handler-on-started-controllerscljs

(call-handler-on-started-controllers app-db-atom reporter start)
source

call-ssr-handler-on-started-controllerscljs

(call-ssr-handler-on-started-controllers app-db-atom
                                         reporter
                                         start
                                         ssr-handler-done-cb)
source

report-running-controllerscljs

(report-running-controllers app-db-atom)
source

route-change-execution-plancljs

(route-change-execution-plan route-params running-controllers controllers)
source

send-route-changed-to-surviving-controllerscljs

(send-route-changed-to-surviving-controllers app-db-atom
                                             reporter
                                             route-changed
                                             route-params)
source

startcljs

(start route-chan
       route-processor
       commands-chan
       app-db-atom
       controllers
       reporter)

Starts the controller manager. Controller manager is the central part of the application that manages the lifecycle of the controllers and routes the messages sent to them.

start function receives the following parameters:

  • route-chan - Route changes will communicated through this channel
  • route-processor - Function that will be called on every route change. It can be used to process the route before it's written into app-db
  • commands-chan - User (UI) commands will be sent through this channel
  • app-db - application state atom
  • controllers map of controllers registered for the app
  • reporter - internal reporter function

Each time when the new route data comes through the route-chan controller manager will do the following:

  • call the params function on each registered controller
  • compare the value returned by the params function with the value that was returned last time when the route changes
  • based on the comparison it will do one of the following:
    • if the last value was nil and the current value is nil - do nothing
    • if the last value was nil and the current value is not nil - start the controller
    • if the last value was not nil and the current value is nil - stop the controller
    • if the last value was not nil and the current value is not nil and these values are the same - do nothing
    • if the last value was not nil and the current value is not nil and these values are different - restart the controller (stop the current instance and start the new one)

Controller manager also acts as a command router. Each time a command comes - through the commands-chan the name of the command should look like this [:controlnler-key :command-name]. Controller manager will route the :command-name command to the appropriate controller based on the :controller-key. Controller key is the key under which the controller was registered in the controllers argument.

Starts the controller manager. Controller manager is the central part
of the application that manages the lifecycle of the controllers and routes
the messages sent to them.

`start` function receives the following parameters:

- `route-chan` - Route changes will communicated through this channel
- `route-processor` - Function that will be called on every route change. It can be used to process the route before it's written into app-db
- `commands-chan` - User (UI) commands will be sent through this channel
- `app-db` - application state atom
- `controllers` map of controllers registered for the app
- `reporter` - internal reporter function

Each time when the new route data comes through the `route-chan` controller
manager will do the following:

- call the `params` function on each registered controller
- compare the value returned by the `params` function with the value that
was returned last time when the route changes
- based on the comparison it will do one of the following:
  - if the last value was `nil` and the current value is `nil` - do nothing
  - if the last value was `nil` and the current value is not `nil` - start the controller
  - if the last value was not `nil` and the current value is `nil` - stop the controller
  - if the last value was not `nil` and the current value is not `nil` and these values are the same - do nothing
  - if the last value was not `nil` and the current value is not `nil` and these values are different - restart the controller (stop the current instance and start the new one)

Controller manager also acts as a command router. Each time a command comes - through the `commands-chan`
the name of the command should look like this `[:controlnler-key :command-name]`. Controller manager will route the `:command-name` command to the appropriate controller based on the `:controller-key`. Controller key is the key under which the controller was registered in the `controllers` argument.
sourceraw docstring

start-ssrcljs

(start-ssr routes-chan commands-chan app-db-atom controllers reporter done-cb)
source

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

× close