Class: BaseController

BaseController(activationUri, repo, view)

This class provide some basic logic for a controller. It hold a statemachine and it is configured to the following behaviour.

Constructor

new BaseController(activationUri, repo, view)

Parameters:
Name Type Description
activationUri string

The url which determines when it should be active.

repo Repo

The repo of proxy objects

view View

The view to talk to.

Source:

Members

state

Gets current state

Source:

Methods

addTransition(transition)

Add a transtion

Parameters:
Name Type Description
transition Transtion

The transition

Source:

canChange(event) → {boolean}

Tells if the event is a property change from the view.

Parameters:
Name Type Description
event Event

The event

Source:
Returns:

true on match otherwise false

Type
boolean

canPopulate(event) → {boolean}

Tells if the event is from a proxy.

Parameters:
Name Type Description
event Event

The event

Source:
Returns:

true on match otherwise false

Type
boolean

canShow(event) → {boolean}

Tells if the event is from router and the given url == this.activationUrl

Parameters:
Name Type Description
event Event

The event

Source:
Returns:

true on match otherwise false

Type
boolean

canStop(event) → {boolean}

Tells if the event is from router and the given url =! this.activationUrl

Parameters:
Name Type Description
event Event

The event

Source:
Returns:

true on match otherwise false

Type
boolean

fail(event)

Show the error

Parameters:
Name Type Description
event Event

The event

Source:

handleEvent(event)

Handle the event by running the statemachine

Parameters:
Name Type Description
event Event

The event

Source:

hasFailed(event) → {boolean}

Tells if the event is a fail event or not

Parameters:
Name Type Description
event Event

The event

Source:
Returns:

true when failed other false

Type
boolean

populate(event)

Populate the view with data from a proxy

Parameters:
Name Type Description
event Event

The event

Source:

populateStateMachine()

Populate the statemachine with transitions according to state diagram

Source:

show(event)

Show the view and request data from the proxies which are used in the view

Parameters:
Name Type Description
event Event

The event

Source:

stop(event)

Stop this controller.

Parameters:
Name Type Description
event Event

The event

Source: