Class: Application

conbo.Application(options)

new Application(options)

Application Base application class for client-side applications
Parameters:
Name Type Description
options Object Object containing optional initialisation options, see View
Author:
  • Neil Rackett
Source:
Fires:

Extends

Members

attributes :Object

Attributes to apply to the View's element
Type:
  • Object
Inherited From:
Source:

autoInitTemplate :boolean

Whether or not the template should automatically be loaded and applied, rather than waiting for the user to call initTemplate (default: true)
Type:
  • boolean
Inherited From:
Source:

body :HTMLElement

A View's body is the element to which content should be added: the View's content, if it exists, or the View's main element, if it doesn't
Type:
  • HTMLElement
Inherited From:
Source:

className :string

CSS class name(s) to apply to the View's element
Type:
  • string
Inherited From:
Source:

content :HTMLElement

The element into which HTML content should be placed; this is either the first DOM element with a `cb-content` or the root element of this view
Type:
  • HTMLElement
Inherited From:
Source:

contextClass :conbo.Context

Default context class to use You'll normally want to override this with your own
Type:
Source:

currentState :string

The current view state. When set, adds "cb-state-x" CSS class on the View's element, where "x" is the value of currentState.
Type:
  • string
Inherited From:
Source:

data :Object

Arbitrary data Object
Type:
  • Object
Inherited From:
Source:

el :HTMLElement

This View's element
Type:
  • HTMLElement
Inherited From:
Source:

hasContent :boolean

Does this View support HTML content?
Type:
  • boolean
Inherited From:
Source:

hasTemplate :boolean

Does this view have a template?
Type:
  • boolean
Inherited From:
Source:

id :string

ID to apply to the View's element
Type:
  • string
Inherited From:
Source:

initialized :boolean

Has this view completed its life cycle phases?
Type:
  • boolean
Inherited From:
Source:

initialView :conbo.View|function

If specified, this View will be appended immediately after the Application is intialized. If this property is set to a class, it will be instantiated automatically the first time this property is read, with initialViewOptions passed to the constructor.
Type:
Source:

initialViewOptions :*

If initialView is a View class, the initialViewOptions will be passed to the constructor when it is instantiated and added to the application
Type:
  • *
Source:

namespace :conbo.Namespace

The application's namespace (uses 'default' namespace if not overridden)
Type:
Source:

observeEnabled :boolean

If true, the application will automatically apply Glimpse and View classes to elements when they're added to the DOM
Type:
  • boolean
Source:

parent :conbo.View

Returns a reference to the parent View of this View, based on this View element's position in the DOM
Type:
Inherited From:
Source:

parentApp :conbo.Application

Returns a reference to the parent Application of this View, based on this View element's position in the DOM
Type:
Inherited From:
Source:

style :any

Object containing CSS styles to apply to this View's element
Type:
  • any
Inherited From:
Source:

subcontext :conbo.Context

The context that will automatically be applied to children when binding or appending Views inside of this View
Type:
Inherited From:
Source:

supro

Similar to `super` in ActionScript or Java, this property enables you to access properties and methods of the super class prototype, which is the case of JavaScript is the next prototype up the chain
Inherited From:
Source:

tagName :string

The tag name to use for the View's element (if no element specified)
Type:
  • string
Inherited From:
Source:

template :string

Template to apply to the View's element
Type:
  • string
Inherited From:
Source:

templateCacheEnabled :boolean

Whether or not the contents of templateUrl should be cached on first load for use with future instances of this View class (default: true)
Type:
  • boolean
Inherited From:
Source:

templateUrl :string

Template to load and apply to the View's element
Type:
  • string
Inherited From:
Source:

Methods

addEventListener(type, handler, scopeopt, priorityopt, onceopt) → {conbo.EventDispatcher}

Add a listener for a particular event type
Parameters:
Name Type Attributes Default Description
type string Type of event ('change') or events ('change blur')
handler function Function that should be called
scope Object <optional>
Options object (recommended) or the scope in which to run the event handler (deprecated)
priority number <optional>
0 The event handler's priority when the event is dispatached (deprecated)
once boolean <optional>
false Should the event listener automatically be removed after it has been called once? (deprecated)
Inherited From:
Source:
Returns:
A reference to this class instance
Type
conbo.EventDispatcher

appendView(view) → {this}

Append this DOM element from one View class instance this class instances DOM element
Parameters:
Name Type Description
view conbo.View | function The View instance to append
Inherited From:
Source:
Returns:
Type
this

bindAll(…methodNameopt) → {this}

Scope all methods of this class instance to this class instance
Parameters:
Name Type Attributes Description
methodName string <optional>
<repeatable>
Specific method names to bind (all will be bound if none specified)
Inherited From:
Source:
Returns:
Type
this

bindView() → {this}

Automatically bind elements to properties of this View
Inherited From:
Source:
Returns:
Type
this
Example
<div cb-bind="property|parseMethod" cb-hide="property">Hello!</div> 

creationComplete()

Convenience method for conbo.ConboEvent.CREATION_COMPLETE event handler
Inherited From:
Source:

declarations() → {void}

Declarations is used to declare instance properties used by this class
Parameters:
Type Attributes Description
* <repeatable>
Inherited From:
Source:
Returns:
Type
void

destroy() → {void}

Clean everything up ready for garbage collection (you should override in your own classes)
Inherited From:
Source:
Returns:
Type
void

detach() → {this}

Take the View's element element out of the DOM
Inherited From:
Source:
Returns:
Type
this

dispatchChange(propName) → {conbo.EventDispatcher}

Dispatch a change event for one or more changed properties
Parameters:
Name Type Description
propName string The name of the property that has changed
Inherited From:
Source:
Returns:
A reference to this class instance
Type
conbo.EventDispatcher

dispatchEvent(event) → {conbo.EventDispatcher}

Dispatch the event to listeners
Parameters:
Name Type Description
event conbo.Event The event to dispatch
Inherited From:
Source:
Returns:
A reference to this class instance
Type
conbo.EventDispatcher

hasEventListener(type, handleropt, scopeopt) → {boolean}

Does this object have an event listener of the specified type?
Parameters:
Name Type Attributes Description
type string Type of event (e.g. 'change')
handler function <optional>
Function that should be called
scope Object <optional>
Options object (recommended) or the scope in which to run the event handler (deprecated)
Inherited From:
Source:
Returns:
True if this object has the specified event listener, false if it does not
Type
boolean

initialize() → {void}

Initialize (entry point) is called immediately after the constructor has completed
Parameters:
Type Attributes Description
* <repeatable>
Inherited From:
Source:
Returns:
Type
void

initTemplate() → {this}

Initialize the View's template, either by loading the templateUrl or using the contents of the template property, if either exist
Inherited From:
Source:
Returns:
Type
this

loadTemplate(urlopt) → {this}

Load HTML template and use it to populate this View's element
Parameters:
Name Type Attributes Description
url string <optional>
The URL to which the request is sent
Inherited From:
Source:
Returns:
Type
this

preinitialize() → {void}

Preinitialize is called before any code in the constructor has been run
Parameters:
Type Attributes Description
* <repeatable>
Inherited From:
Source:
Returns:
Type
void

prependView(view) → {this}

Prepend this DOM element from one View class instance this class instances DOM element
Parameters:
Name Type Description
view conbo.View The View instance to preppend
Inherited From:
Source:
Returns:
Type
this

querySelector(selector, deep) → {HTMLElement}

Uses querySelector to find the first matching element contained within the current View's element, but not within the elements of child Views
Parameters:
Name Type Description
selector string The selector to use
deep boolean Include elements in child Views?
Inherited From:
Source:
Returns:
The first matching element
Type
HTMLElement

querySelectorAll(selector, deep) → {Array}

Uses querySelectorAll to find all matching elements contained within the current View's element, but not within the elements of child Views
Parameters:
Name Type Description
selector string The selector to use
deep boolean Include elements in child Views?
Inherited From:
Source:
Returns:
All elements matching the selector
Type
Array

remove() → {this}

Remove and destroy this View by taking the element out of the DOM, unbinding it, removing all event listeners and removing the View from its Context. You should use a REMOVE event handler to destroy any event listeners, timers or other persistent code you may have added.
Inherited From:
Source:
Returns:
Type
this

removeEventListener(typeopt, handleropt, scopeopt) → {conbo.EventDispatcher}

Remove a listener for a particular event type
Parameters:
Name Type Attributes Description
type string <optional>
Type of event ('change') or events ('change blur'), if not specified, all listeners will be removed
handler function <optional>
Function that should be called, if not specified, all listeners of the specified type will be removed
scope Object <optional>
Options object (recommended) or the scope in which to run the event handler (deprecated)
Inherited From:
Source:
Returns:
A reference to this class instance
Type
conbo.EventDispatcher

templateComplete()

Convenience method for conbo.ConboEvent.TEMPLATE_COMPLETE event handler
Inherited From:
Source:

toString() → {string}

String representation of the current class
Overrides:
Source:
Returns:
Type
string

unbindView() → {this}

Unbind elements from class properties
Inherited From:
Source:
Returns:
Type
this