Class: View

F. View

new View(options)

Generic view class. Provides rendering and templating based on a model, eventing based on a component, and element management based on a container or existing element
Parameters:
Name Type Description
options Object Options for this view
Properties
Name Type Argument Description
template Template The template to render this view with
el Element <optional>
The DOM element, jQuery selector, or jQuery object to render this view to. Should not be used with options.container
container Element <optional>
The DOM element, jQuery selector, or jQuery object to insert this components element into. Should not be used with options.el
model Backbone.Model <optional>
Instance of a Backbone model to render this view from
component Component <optional>
The component that events should be delegated to
events Object <optional>
Backbone events object indicating events to listen for on this view
Properties:
Name Type Description
template Template The template to render this view with
Source:

Methods

age() → {number}

Get the time since the view was last rendered
Source:
Returns:
Number of milliseconds since this view was rendered
Type
number

delegateEvents(events) → {F.View}

Delegate events to this view. This overrides Backbone.View.delegateEvents and lets us specify an object to call methods on instead of the view
Parameters:
Name Type Description
events Object Events hash to delegate
Source:
Returns:
this, chainable
Type
F.View

hide() → {F.View}

Hide the view
Source:
Returns:
this, chainable
Type
F.View

remove()

Remove this view from the DOM and stop listening to model change events
Source:

render() → {F.View}

Render the view
Source:
Returns:
this, chainable
Type
F.View

renderOnce() → {F.View}

Render the view only if it has not been rendered before (or has been reset)
Source:
Returns:
this, chainable
Type
F.View

show() → {F.View}

Show the view. The view will be rendered before it is shown if it hasn't already been rendered
Source:
Returns:
this, chainable
Type
F.View