View

View

View consider as single UI screen.

View contains Contents consist of "Containers" and "Components" and Model.

View can be use with Core HTML Components also.

View manages View Template or DOM Content such behaviour, event listners etc.

View created and manage by ViewNavigator.

View HTML DOM wrapper: < div class="vjs-view ${viewId}" >

View LifeCycle methods executes in given order :

  1. Creation : constructor, attachView, activateView

  2. Destruction : deActivateView, detachView, destroy

Following methods overrides and implement by View subclass executes in given order :

  1. Creation : constructor, initView, createViewContent, addViewHandler, bindView

  2. Destruction : unBindView, removeViewHandler, destroy

Constructor

new View(_id, _route, _navevent, _navparams, _parentViewStackId)

Source:
Parameters:
Name Type Description
_id String

View Id

_route String

View Route

_navevent String

View Navigation Event Name

_navparams String

Parameters pass to View

_parentViewStackId String

Parent Viewstack Id

Classes

View

Methods

activateView()

Source:

View Lifecycle Method

Call by ViewNavigator

attached View visible

addToViewElement(_tmpViewContentEl)

Source:

Add Content DOM ELement to View DOM Element

Parameters:
Name Type Description
_tmpViewContentEl string

Content DOM Element

addViewHandler()

Source:

Add Event Handlers for view Internal Components

attachView(_parentEl)

Source:

View Lifecycle Method, Call by ViewNavigator,

attachView Responsible to render view content, listners etc,

Dispatch "ATTACHED_EVENT" when view got attached / rendered,

Following methods call by attachView : createViewContent addViewHandler bindView

Parameters:
Name Type Default Description
_parentEl String null

bindView()

Source:

Bind View Component Properties with Model or other view Components

createViewContent()

Source:

Create View Contents and Internal Components

deActivateView()

Source:

View Lifecycle Method

Call by ViewNavigator

attached View if visible (active) then will become nonvisible

destroy()

Source:

Destroy Method used to cleanup view resources Call by ViewNavigator to destroy view Remove Event Handlers, Make Properties null, Remove View Components and its reference.

detachView()

Source:

View Lifecycle Method

Call by ViewNavigator

View will be remove if View is attached

dispatchNavBackEvent(event)

Source:
Parameters:
Name Type Description
event Event

Back Navigation Event dispatch by view component or method

getViewElement() → {string}

Source:

Returns View DOM Element

Returns:
Type
string

initView()

Source:

Call by View Constructor

refreshView()

Source:

RefreshView method reset View properties or data

removeViewHandler()

Source:

Remove Event Handlers for view Internal Components

unBindView()

Source:

Remove Bind View Component Properties with Model or other view Components