AbstractScreen
On this page
- AbstractScreen ⇐
View
- AbstractScreen()
- prepareData([context]) ⇒
Promise.<Object, Error>
- connectData([context]) ⇒
Promise.<undefined, Error>
|undefined
- loadingStart()
- loadingStop()
- beforeShow([context]) ⇒
Promise.<undefined, Error>
|undefined
- beforeHide([context]) ⇒
Promise.<undefined, Error>
|undefined
- show(options)
- hide(options)
- subscribe(eventType, [callback]) ⇒
number
- unsubscribe(eventType, callback) ⇒
number
- subscribeInput(eventType, callback) ⇒
number
- subscribeBlockedInput(eventType, callback) ⇒
number
- unsubscribeInput(eventType, callback) ⇒
number
- unsubscribeBlockedInput(eventType, callback) ⇒
number
- route(routeName, [data]) ⇒
Promise.<Object, Error>
- routeToPrevious(data) ⇒
Promise.<Object, Error>
- setData(data)
- _ready([context])
- _connectData([context]) ⇒
Promise.<Object, Error>
|undefined
- _loadingStart()
- _loadingStop()
- _showChildren(options)
- _hideChildren(options) ⇒
boolean
- _subscribe(eventType, callback) ⇒
number
- _unsubscribe(eventType, callback) ⇒
number
- _subscribeInput(eventType, callback) ⇒
number
- _unsubscribeInput(eventType, callback) ⇒
number
- _build()
- _getChildToFocus()
- rendererCreate() ⇒
*
- inputs
- blockedInputs
- listen
- getId() ⇒
string
- display([context]) ⇒
Promise.<Object, Error>
- declare()
- getInstanceFromJson(json) ⇒
Promise.<AbstractScreen>
AbstractScreen ⇐ View
Kind: global abstract class
Extends: View
Singleton:
Properties
Name | Type | Default | Description |
---|---|---|---|
isScreen | boolean | flag Feature flag (always true) | |
_playingAnimations | Array | ||
deferred | Boolean | false | If set to true, defer the |
context | Object | The last context used to display the screen | |
height | number | [READONLY] The height of the screen | |
width | number | [READONLY] The width of the screen | |
isReady | boolean | [READONLY] Flag which indicates if the screen is ready (i.e. when its data is loaded and associated startup animations are done) | |
loadingStartTimeout | number | Loading time in ms to wait before showing and starting the loader (if the screen is not ready in loadingStartTimeout, the loader is started) | |
loadingStopTimeout | number | Stopping time in ms to wait before hiding and stopping the loader (make sure the loader will be shown at least for loadingStopTimeout) | |
id | String | The identifier of the screen which can be retrieved using #getId | |
timerManager | TimerManager | A reference on the timer manager |
- AbstractScreen ⇐
View
- new AbstractScreen()
- instance
- .prepareData([context]) ⇒
Promise.<Object, Error>
- .connectData([context]) ⇒
Promise.<undefined, Error>
|undefined
- .loadingStart()
- .loadingStop()
- .beforeShow([context]) ⇒
Promise.<undefined, Error>
|undefined
- .beforeHide([context]) ⇒
Promise.<undefined, Error>
|undefined
- .show(options)
- .hide(options)
- .subscribe(eventType, [callback]) ⇒
number
- .unsubscribe(eventType, callback) ⇒
number
- .subscribeInput(eventType, callback) ⇒
number
- .subscribeBlockedInput(eventType, callback) ⇒
number
- .unsubscribeInput(eventType, callback) ⇒
number
- .unsubscribeBlockedInput(eventType, callback) ⇒
number
- .route(routeName, [data]) ⇒
Promise.<Object, Error>
- .routeToPrevious(data) ⇒
Promise.<Object, Error>
- .setData(data)
- ._ready([context])
- ._connectData([context]) ⇒
Promise.<Object, Error>
|undefined
- ._loadingStart()
- ._loadingStop()
- ._showChildren(options)
- ._hideChildren(options) ⇒
boolean
- ._subscribe(eventType, callback) ⇒
number
- ._unsubscribe(eventType, callback) ⇒
number
- ._subscribeInput(eventType, callback) ⇒
number
- ._unsubscribeInput(eventType, callback) ⇒
number
- ._build()
- ._getChildToFocus()
- .rendererCreate() ⇒
*
- .prepareData([context]) ⇒
- static
- .inputs
- .blockedInputs
- .listen
- .getId() ⇒
string
- .display([context]) ⇒
Promise.<Object, Error>
- .declare()
- .getInstanceFromJson(json) ⇒
Promise.<AbstractScreen>
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
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
options | Object | Additional options |
options.childToFocus | String | 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
Param | Type | Description |
---|---|---|
options | Object | 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
Param | Type | Description |
---|---|---|
eventType | String | 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
Param | Type | Description |
---|---|---|
eventType | String | The type of the event. @see Event |
callback | function | 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
Param | Type | Description |
---|---|---|
eventType | String | The type of the event. @see Event |
callback | function | 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
Param | Type | Description |
---|---|---|
eventType | String | The type of the event. @see Event |
callback | function | 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
Param | Type | Description |
---|---|---|
eventType | String | The type of the event. @see Event |
callback | function | 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
Param | Type | Description |
---|---|---|
eventType | String | The type of the event. @see Event |
callback | function | 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
Param | Type | Description |
---|---|---|
routeName | String | 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
Param | Type | Description |
---|---|---|
data | Object | 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
Param | Type | Description |
---|---|---|
data | Object | 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
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
options | Object | 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
Param | Type | Description |
---|---|---|
options | Object | 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
Param | Type | Description |
---|---|---|
eventType | String | The type of the event. @see Event |
callback | function | 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
Param | Type | Description |
---|---|---|
eventType | String | The type of the event. @see Event |
callback | function | 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
Param | Type | Description |
---|---|---|
eventType | String | The type of the event. @see Event |
callback | function | 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
Param | Type | Description |
---|---|---|
eventType | String | The type of the event. @see Event |
callback | function | 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.
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
json | Object | the properties of the screen to render |