Home Reference Source
import {Controller} from 'arva-js/core/Controller.js'
public class | source

Controller

Extends:

eventemitter3~EventEmitter → Controller

Constructor Summary

Public Constructor
public

constructor(spec: Spec)

Saves the router and context to this.router and this.context, respectively.

Member Summary

Public Members
public

context: AnimationController

The AnimationController used globally in the app to change screens

public
public

The router used globally in the app

public

spec: *

Method Summary

Public Methods
public

onLeave(newRoute: *)

Called to notify the Controller that the route is changed

public

Called by the Router when this controller instance is being navigated to.

Public Constructors

public constructor(spec: Spec) source

Saves the router and context to this.router and this.context, respectively.

Params:

NameTypeAttributeDescription
router. Router

Injected globablly used router

context. AnimationController

Injected animationController used by the app

spec Spec

Public Members

public context: AnimationController source

The AnimationController used globally in the app to change screens

public isActive: boolean source

public router: Router source

The router used globally in the app

public spec: * source

Public Methods

public onLeave(newRoute: *) source

Called to notify the Controller that the route is changed

Params:

NameTypeAttributeDescription
newRoute *

public onRouteCalled(route: Object): Boolean source

Called by the Router when this controller instance is being navigated to. Calls the controller's method in the given route, and triggers a famous-flex AnimationController show() with the View instance that the method returns. Is also capable of receiving a Promise from the method, in which case the show() is called after the promise is resolved.

Params:

NameTypeAttributeDescription
route Object

Route object generated by the Router. Contains a method name to call, and a render spec for passing to the AnimationController.

Return:

Boolean

success Whether the controller method was fully executed, and the Router should emit a routechange event.