Application

Skull. Application

new Application()

Skull.Application is very basic sample of application. It does several things:

  1. creates registry and registers itself as 'app'
  2. detects domain and other passes URL to UrlProvider
  3. instantiates syncer
  4. instantiates router
  5. Detects if debug mode is on
  6. renders root view and starts Backbone.history, if autostart option passed

App dispatches route changes. Bind to path event to handle them.

Source:

Extends

Methods

(protected) _parentResult(cls, propertyName) → {*}

Much like a _.result, but ascending to parent

Parameters:
Name Type Description
cls function

class derived in usual Skull paradigm (i.e. with __super__ property pointing to parent's prototype)

propertyName String
Inherited From:
Source:
Returns:

Most of the times it is Object

Type
*

(protected) _registerComponent(componentName) → {Object}

Creates application component and registers it, following config

Parameters:
Name Type Description
componentName String

should be present in params passed to application

Source:
Returns:

instance of component

Type
Object

initialize(options)

Parameters:
Name Type Description
options

app options

Properties
Name Type Attributes Default Description
rootView Skull.View

Skull.View class, intended to be root view

router Backbone.Router

Router class to be used

syncer Skull.Syncer <optional>
Skull.Syncer

Skull.Syncer class to be used

node $ | String | HTMLElement <optional>
'html'

root node for application; gets passed to options.rootView

dataDomainSelector String <optional>

selector to be passed to Skull.detectDomain

urlOptions Object <optional>

options for Skull.UrlProvider.

debug Boolean <optional>
false

Whether we are in debug mode, you can provide other ways for checking it

autostart Boolean <optional>
false

Whether application should start right when instantiated

Overrides:
Source:

onRoute(router, routeName, params)

Primarily dispatches route change. Feel free to override.

Parameters:
Name Type Description
router Backbone.Router

router which fired event

routeName String

name of matched route

params Object

parameters parsed from route, if any

Source:

start()

Renders root view and starts up Backbone.history. Call this when your app is ready (or pass options.autostart to Skull.Application#initialize). Feel free to override.

Source: