AbstractScreen

AbstractScreen ⇐ View

Kind: global abstract class
Extends: View
Singleton:
Properties

NameTypeDefaultDescription
isScreenboolean

flag Feature flag (always true)

_playingAnimationsArray
deferredBooleanfalse

If set to true, defer the prepareData() method (i.e. do not wait data before showing the screen)

contextObject

The last context used to display the screen

heightnumber

[READONLY] The height of the screen

widthnumber

[READONLY] The width of the screen

isReadyboolean

[READONLY] Flag which indicates if the screen is ready (i.e. when its data is loaded and associated startup animations are done)

loadingStartTimeoutnumber

Loading time in ms to wait before showing and starting the loader (if the screen is not ready in loadingStartTimeout, the loader is started)

loadingStopTimeoutnumber

Stopping time in ms to wait before hiding and stopping the loader (make sure the loader will be shown at least for loadingStopTimeout)

idString

The identifier of the screen which can be retrieved using #getId

timerManagerTimerManager

A reference on the timer manager

AbstractScreen()

A ‘root’ view that can be managed by the router and that is also connected to the EventBus. It contains children (i.e. View or Element) but is also holding and managing its business data and input events.

prepareData([context]) ⇒ Promise.<Object, Error>

Prepare screen data: get the business data to feed the views. View should always be fully filled with business model(s).

It must returns a Object.

Kind: instance abstract method of AbstractScreen
Returns: Promise.<Object, Error> - returns a promise resolved with the data

ParamTypeDescription
[context]Object

The context shared by the screens during display

connectData([context]) ⇒ Promise.<undefined, Error> | undefined

Connect the data prepared by prepareData to the views. Use the data property, which is the return value of prepareData.

Kind: instance abstract method of AbstractScreen
Returns: Promise.<undefined, Error> | undefined - returns a promise or undefined

ParamTypeDescription
[context]Object

The context shared by the screens during display

loadingStart()

Called by the RouterManager to start the loader. In non deferred mode it will be called at the beginning of prepareData. In deferred mode it will be called at the end of show (transition animations finished) if prepareData/connectData is not finished yet

Kind: instance method of AbstractScreen

loadingStop()

Called by the RouterManager to stop the loader. It will be called at the end of connectData.

Kind: instance method of AbstractScreen

beforeShow([context]) ⇒ Promise.<undefined, Error> | undefined

Called before the screen is shown. The flow is interrupted until the promise has been resolved/rejected.

Kind: instance abstract method of AbstractScreen
Returns: Promise.<undefined, Error> | undefined - returns a promise or undefined

ParamTypeDescription
[context]Object

The context shared by the screens during display

beforeHide([context]) ⇒ Promise.<undefined, Error> | undefined

Called before the screen is hidden. The flow is interrupted until the promise has been resolved/rejected.

Kind: instance abstract method of AbstractScreen
Returns: Promise.<undefined, Error> | undefined - returns a promise or undefined

ParamTypeDescription
[context]Object

The context shared by the screens during display

show(options)

Show all views and elements. By default, it is focusing the first element. Beware this is a synchronous method.

Kind: instance method of AbstractScreen

ParamTypeDescription
optionsObject

Additional options

options.childToFocusString

The key of the child to focus

hide(options)

Hide all views and elements. Beware this is a synchronous method.

Kind: instance method of AbstractScreen

ParamTypeDescription
optionsObject

Additional options

subscribe(eventType, [callback]) ⇒ number

Subscribes to an event with the bus event (only when the screen is shown). In case of no callback defined, a generated function (like ‘onMyServiceMyEvent’) will be used for an event named ‘myService.myEvent’.

Kind: instance method of AbstractScreen
Returns: number - An identifier that can be used to un-subscribe

ParamTypeDescription
eventTypeString

The type of the event. @see Event

[callback]function

The callback Function

unsubscribe(eventType, callback) ⇒ number

Unsubscribes a listening method/handler (only when the screen is shown) if you supply the callback function and execution context. It will remove only this associated subscription otherwise will remove all subscriptions.

Kind: instance method of AbstractScreen
Returns: number - The number of events that have been un-subscribed

ParamTypeDescription
eventTypeString

The type of the event. @see Event

callbackfunction

The callback Function

subscribeInput(eventType, callback) ⇒ number

Subscribes to an input event using the input bus event.

Kind: instance method of AbstractScreen
Returns: number - An id that can be used to un-subscribe

ParamTypeDescription
eventTypeString

The type of the event. @see Event

callbackfunction

Callback Function

subscribeBlockedInput(eventType, callback) ⇒ number

Subscribes to a blocked input event using the input bus event.

Kind: instance method of AbstractScreen
Returns: number - An id that can be used to un-subscribe

ParamTypeDescription
eventTypeString

The type of the event. @see Event

callbackfunction

Callback Function

unsubscribeInput(eventType, callback) ⇒ number

Unsubscribes a listening method/handler if you supply the callback function and execution context. It will remove only this associated subscription otherwise will remove all subscriptions.

Kind: instance method of AbstractScreen
Returns: number - The number of events that have been un-subscribed

ParamTypeDescription
eventTypeString

The type of the event. @see Event

callbackfunction

Callback Function

unsubscribeBlockedInput(eventType, callback) ⇒ number

Unsubscribes a listening method/handler of a blocked input if you supply the callback function and execution context. It will remove only this associated subscription otherwise will remove all subscriptions.

Kind: instance method of AbstractScreen
Returns: number - The number of events that have been un-subscribed

ParamTypeDescription
eventTypeString

The type of the event. @see Event

callbackfunction

Callback Function

route(routeName, [data]) ⇒ Promise.<Object, Error>

Alias method to AbstractRouterManager’s one.

Kind: instance method of AbstractScreen
Returns: Promise.<Object, Error> - Returns a promise resolved with the context, or rejected with the cause of the error

ParamTypeDescription
routeNameString

the route name

[data]Object

the route data (used by the route provider)

routeToPrevious(data) ⇒ Promise.<Object, Error>

Alias method to AbstractRouterManager’s one.

Kind: instance method of AbstractScreen
Returns: Promise.<Object, Error> - Returns a promise resolved with the context, or rejected with the cause of the error

ParamTypeDescription
dataObject

Optional parameters used as context which are shared between screens

setData(data)

Set the business data that feed the views.

Kind: instance method of AbstractScreen

ParamTypeDescription
dataObject

The data used by the views

_ready([context])

Called by the RouterManager when current screen is ready (i.e. prepareData are loaded and animations are finished)

Kind: instance method of AbstractScreen
Access: protected

ParamTypeDescription
[context]Object

The context shared by the screens during display

_connectData([context]) ⇒ Promise.<Object, Error> | undefined

Called by the RouterManager when the screen has retrieved data (i.e. prepareData are loaded and current screen is shown)

Kind: instance method of AbstractScreen
Returns: Promise.<Object, Error> | undefined - returns a promise resolved with the data or undefined
Access: protected

ParamTypeDescription
[context]Object

The context shared by screens during the display step

_loadingStart()

Called by the RouterManager to start the loader.

In deferred mode it will be called at the end of show (transition animations finished) if prepareData/connectData not finished yet

Kind: instance method of AbstractScreen
Access: protected

_loadingStop()

Called by the RouterManager to stop the loader.

Kind: instance method of AbstractScreen
Access: protected

_showChildren(options)

Show the children registered so far

Kind: instance method of AbstractScreen
Access: protected

ParamTypeDescription
optionsObject

Additional options

_hideChildren(options) ⇒ boolean

Hide children

Kind: instance method of AbstractScreen
Returns: boolean - Set to true if not all children are hidden (because of a pending animation)
Access: protected

ParamTypeDescription
optionsObject

Additional options

_subscribe(eventType, callback) ⇒ number

Subscribes to an event using the bus event.

Kind: instance method of AbstractScreen
Returns: number - An id that can be used to un-subscribe

ParamTypeDescription
eventTypeString

The type of the event. @see Event

callbackfunction

The callback Function

_unsubscribe(eventType, callback) ⇒ number

Unsubscribes a listening method if you supply the callback function and execution context. It will remove only this associated subscription otherwise remove all subscriptions.

Kind: instance method of AbstractScreen
Returns: number - The number of events that have been un-subscribed

ParamTypeDescription
eventTypeString

The type of the event. @see Event

callbackfunction

The callback Function

_subscribeInput(eventType, callback) ⇒ number

Subscribes to an input event with the input bus event

Kind: instance method of AbstractScreen
Returns: number - An id that can be used to un-subscribe

ParamTypeDescription
eventTypeString

The type of the event. @see Event

callbackfunction

Callback Function

_unsubscribeInput(eventType, callback) ⇒ number

Unsubscribes a listening method if you supply the callback function and execution context. It will remove only this associated subscription otherwise remove all subscriptions.

Kind: instance method of AbstractScreen
Returns: number - The number of events that have been un-subscribed

ParamTypeDescription
eventTypeString

The type of the event. @see Event

callbackfunction

Callback Function

_build()

Kind: instance method of AbstractScreen

_getChildToFocus()

Kind: instance method of AbstractScreen

rendererCreate() ⇒ *

Method which creates the drawing context and adds it to the root one.

Kind: instance method of AbstractScreen
Returns: * - drawing context

inputs

Map for inputs event when the screen is shown (for keyboard). The key is an input event type (as “keypress.UP”: “keyUpAction”), and the value is the name of the function of the class to call when the input event is received. The value can NOT be a function

Kind: static property of AbstractScreen
Example

inputs: ["keypress.UP"]

blockedInputs

Map for inputs event blocked during screen loading (subscription after screen ready) (for keyboard or touch). Remark: If a key input is included in both inputs and blocked inputs, it will be used as blocked input. The key is an input event type (as “keypress.UP”: “keyUpAction”), and the value is the name of the function of the class to call when the input event is received. The value can NOT be a function

Kind: static property of AbstractScreen
Example

blockedInputs: ["keypress.UP"]

listen

Map list for bus events. The key is an event type (as “volumeService.volumeChange”), and the value is the name of the function of the class to call when the event is received. The value can NOT be a function

Kind: static property of AbstractScreen
Example

listen: [$VolumeService.volumeChange]   // will call 'onVolumeServiceVolumeChange'

getId() ⇒ string

Kind: static method of AbstractScreen
Returns: string - a unique identifier for the screen which is the name of the class, with its first letter in lowercase

display([context]) ⇒ Promise.<Object, Error>

Display the screen.

Kind: static method of AbstractScreen
Returns: Promise.<Object, Error> - A promise resolved with the context, rejected otherwise with the cause of the error
See: AbstractRouterManager displayScreen method.

ParamTypeDescription
[context]Object

The context shared between screens for the whole flow, which contains additional options

declare()

Kind: static method of AbstractScreen

getInstanceFromJson(json) ⇒ Promise.<AbstractScreen>

Render a static screen from a JSON Object.

Kind: static method of AbstractScreen
Returns: Promise.<AbstractScreen> - A reference on the loaded screen

ParamTypeDescription
jsonObject

the properties of the screen to render