nl_tokens: Function : start When the application is coming up this method gets called from Barefoot . Startup . Client .
pl_tokens: function start ( ) { /* global window,Backbone */ var Barefoot = require ( '../' ) ( ) , self = this , originalRender = this . render , originalNavigate = this . navigate ; // Lazy-Load the barefoot objects CookieAdapter and DataStore. Otherwise // we'd have some cyclic dependency problems. CookieAdapter = Barefoot . CookieAdapter ; DataStore = Barefoot . DataStore ; self . cookieAdapter = new CookieAdapter ( ) ; self . dataStore = new DataStore ( ) ; // Ensure the request context is set up for the client router: if ( ! _ . isUndefined ( self . setupRequestContext ) ) { self . setupRequestContext . call ( self ) ; } // If present, deserialize the DataStore: if ( ! _ . isUndefined ( window . deserializeDataStore ) ) { var deserializedDataStore = window . deserializeDataStore ( ) ; self . dataStore . parse ( deserializedDataStore ) ; } // If defined, restore the main view: if ( ! _ . isUndefined ( this . mainView ) ) { var mainView = this . mainView ( ) ; mainView . delegateEventsOnSubviews ( ) ; } // Temporarily replace the normal render function to allow restoring the // necessary view object. In case any router function calls navigate, that // one gets replaced to. this . navigate = function startupNavigate ( ) { } ; this . render = function startupRenderer ( view ) { self . currentView = view ; view . delegateEventsOnSubviews ( ) ; // Important: restore the normal render and navigate function: self . render = originalRender ; self . navigate = originalNavigate ; } ; // Get the current route and run its callback (which will call the replaced // render function most probably): var currentRoute = window . <mask> . pathname ; Backbone . history . loadUrl ( currentRoute ) ; }