The App object is the bread and butter of a Plait application. Even so, its API is tiny.


Starts a Plait application life cycle from a root component.


component (Object)

A component object which has all of the following properties:

  • init (Function)
  • update (Function)
  • view (Function)


(DOMNode): The root node of the application. This can be inserted into the document to render an application on the page.

render(appNode, rootNode)

Renders a Plait application node to a DOM node.


appNode (DOMNode)

A Plait application node returned from start(component).

rootNode (DOMNode)

The DOM node which the application node should be rendered to.


(DOMNode): The root DOM node.

initializeComponent(component, [dispatch])

Initializes a component. Used to create child components from within a parent component.


component (Object)

A component object which has at least the following properties:

  • init (Function)
[dispatch] (Function)

A dispatcher function. This is only required when the return value of component.init() is of type [initialState, initialAction]. In this case, the initialAction action is dispatched using the dispatch function.


(State): A State object which contains the initial state of component.

forwardDispatch(action, dispatch, state)

Wraps a dispatcher so that any dispatched actions are instead forwarded to the given action. The given action will be annotated with the $fwdAction property, containing the originally dispatched action.

This function is generally used to create a dispatch function which will be passed to the view function of child components. It allows the parent component to forward the child component's actions to its own update function.


action (any)

The action which will be dispatched when the forwarded dispatch function is called.

dispatch (Function)

The dispatcher function to be forwarded.

state (State)

The state given to any asynchronous actions. This is usually the state of a child component.


(Function): A dispatcher function which will forward any incoming actions to the provided action.

results matching ""

    No results matching ""