Barefoot.Router.Client

Client specific code for the Barefoot.Router.  The complete view object restoration when receiving pre-rendered UI’s from the server is handled in the start method.

See also

Summary
Barefoot.Router.ClientClient specific code for the Barefoot.Router.
Functions
preInitializeEnsure that the setupRequestContext function is saved into the router for later use.
startWhen the application is coming up, this method gets called from Barefoot.Startup.Client.
renderCalls the <Barefoot.View.Shared.render> method of the passed Barefoot.View.

Functions

preInitialize

function preInitialize(options)

Ensure that the setupRequestContext function is saved into the router for later use.

Parameters

(Object) optionsOption object literal

start

function start()

When the application is coming up, this method gets called from Barefoot.Startup.Client.

It handles mainly the restoration of the view objects after receiving an already rendered UI from the server.  This process consists of the following steps:

  • If present, an instance of the main view is created and all events are bound to the DOM elements.
  • The Barefoot.Router.Client.render method gets replaced temporarily to avoid re-rendering already available content to the DOM.  The replacement method only ensures that the necessary events get bound to the DOM.

Another important step is the deserialization of the DataStore if the backend serialized a it into the DOM before.  The particular global function is called and the result injected into the clients own DataStore.  For the serialization code see Barefoot.Router.Server.render.

See also

render

function render(view)

Calls the <Barefoot.View.Shared.render> method of the passed Barefoot.View.  If another view was rendered before, Barefoot.View.Client.close gets called to properly remove that view from the DOM before rendering the new view.

Parameters

(Barefoot.View) viewBarefoot.View to render into the DOM.

See also

The barefoot router extends the default backbone router by applying environment specific mixins to it
function preInitialize(options)
Ensure that the setupRequestContext function is saved into the router for later use.
function start()
When the application is coming up, this method gets called from Barefoot.Startup.Client.
function render(view)
Calls the Barefoot.View.Shared.render method of the passed Barefoot.View.
The barefoot view extends the default backbone view by applying an environment specific mixin to it.
This mixin contains client specific code for the Barefoot.View class.
The DataStore is a core object and extends the Barefoot.Model.
function render(view)
This function initiates the rendering of the passed view.
function close()
Removes a view from the DOM and ensures that all events of the view itself and its subviews are removed too.
Close