AbstractNativeRailElement
On this page
- title: AbstractNativeRailElement
- title: itemChooser
- title: direction
- Classes
- Members
- AbstractNativeRailElement ⇐
AbstractNativeElement- AbstractNativeRailElement()
- AbstractNativeRailElement(properties)
- _defineSettings()
- getIndex() ⇒
Promise.<number> - getItem(index) ⇒
Promise.<Object> - setData(datas, index, chooser) ⇒
Promise - scrollTo(index) ⇒
Promise.<Boolean> - _getIndex() ⇒
Promise.<number> - _setData(datas, index, chooser) ⇒
Promise - _scrollTo(index) ⇒
Promise.<Boolean> - onScroll(index, data)
- _onScroll(index) ⇒
Promise - onItemClicked(index, data)
- _onItemClicked(index) ⇒
Promise - ItemChooser :
Object - Item :
Object
- AbstractNativeRailElement
- AbstractNativeRailElement()
- AbstractNativeRailElement(properties)
- _defineSettings()
- getIndex() ⇒
Promise.<number> - getItem(index) ⇒
Promise.<Object> - setData(datas, index, chooser) ⇒
Promise - scrollTo(index) ⇒
Promise.<Boolean> - _getIndex() ⇒
Promise.<number> - _setData(datas, index, chooser) ⇒
Promise - _scrollTo(index) ⇒
Promise.<Boolean> - onScroll(index, data)
- _onScroll(index) ⇒
Promise - onItemClicked(index, data)
- _onItemClicked(index) ⇒
Promise - ItemChooser :
Object - Item :
Object
- itemChooser
- direction
title: AbstractNativeRailElement
title: itemChooser
title: direction
Classes
- AbstractNativeRailElement ⇐
AbstractNativeElement - AbstractNativeRailElement
Members
AbstractNativeRailElement ⇐ AbstractNativeElement
Kind: global abstract class
Extends: AbstractNativeElement
- AbstractNativeRailElement ⇐
AbstractNativeElement- new AbstractNativeRailElement()
- new AbstractNativeRailElement(properties)
- instance
- ._defineSettings()
- .getIndex() ⇒
Promise.<number> - .getItem(index) ⇒
Promise.<Object> - .setData(datas, index, chooser) ⇒
Promise - .scrollTo(index) ⇒
Promise.<Boolean> - ._getIndex() ⇒
Promise.<number> - ._setData(datas, index, chooser) ⇒
Promise - ._scrollTo(index) ⇒
Promise.<Boolean> - .onScroll(index, data)
- ._onScroll(index) ⇒
Promise - .onItemClicked(index, data)
- ._onItemClicked(index) ⇒
Promise
- inner
- ~ItemChooser :
Object - ~Item :
Object
- ~ItemChooser :
AbstractNativeRailElement()
Rail view that will use native component of the engine
Example
$AbstractNativeRailElement.declare("MyNativeRailElement", {
itemChooser: {
key: "ratio",
default: "DefaultTile",
items : [
{
keyValue: "16:9"
item: "LandscapeItem"
},
{
keyValue: "4:3"
item: "PortraitItem"
}
]
},
direction: $RailDirection.VERTICAL
});AbstractNativeRailElement(properties)
Create clean empty or predefined fields inside this rail element at startup.
| Param | Type | Description |
|---|---|---|
| properties | Object | Object holding defined parameters such as direction or itemChooser. |
_defineSettings()
Kind: instance method of AbstractNativeRailElement
getIndex() ⇒ Promise.<number>
Get the index of the current focused item
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<number> - index of the current “focused” item
getItem(index) ⇒ Promise.<Object>
Get the item data at the given index
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Object> - An object that matches the item data at the asked index
| Param | Type | Description |
|---|---|---|
| index | number | index of the element you want to retrieve |
setData(datas, index, chooser) ⇒ Promise
Set all datas to the rail.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| datas | Array.<Object> | List of data to be used for the rail |
| index | Number | Index of the focused item. Default is 0 |
| chooser | ItemChooser | ItemChooser can be passed here to change it |
scrollTo(index) ⇒ Promise.<Boolean>
Scroll to the item at the requested index.
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Boolean> - True if the item has been scrolledTo, false else (out of bound). If the item is already scrolled to, return false
| Param | Type | Description |
|---|---|---|
| index | Number | The index of the item you want to scroll to |
_getIndex() ⇒ Promise.<number>
Get the index of the current focused item
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<number> - index of the current “focused” item
Access: protected
_setData(datas, index, chooser) ⇒ Promise
Set all datas to the rail.
Kind: instance method of AbstractNativeRailElement
Access: protected
| Param | Type | Description |
|---|---|---|
| datas | Array.<Object> | List of data to be used for the rail |
| index | Number | Index of the focused item. Default is 0 |
| chooser | ItemChooser | ItemChooser can be passed here to change it |
_scrollTo(index) ⇒ Promise.<Boolean>
Scroll to the item at the requested index.
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Boolean> - True if the item has been scrolledTo, false else (out of bound). If the item is already scrolled to, return false
Access: protected
| Param | Type | Description |
|---|---|---|
| index | Number | The index of the item you want to scroll to |
onScroll(index, data)
Triggered each time an item has been focused.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| index | Number | Reached index |
| data | Object | The data at the given index |
_onScroll(index) ⇒ Promise
Connect to native trigger each time an item has been focused.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| index | Number | Reached index |
onItemClicked(index, data)
Triggered each time an item has been clicked on.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| index | Number | Reached index |
| data | Object | The data at the given index |
_onItemClicked(index) ⇒ Promise
Connect to native trigger each time an item has been clicked on.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| index | Number | Reached index |
ItemChooser : Object
Define the chooser that will be needed to choose an item depending of the value of a specified key in data
Kind: inner typedef of AbstractNativeRailElement
Properties
| Name | Type | Description |
|---|---|---|
| key | string | Indicates the key id that will be used on data to choose the item. |
| default | string | Indicates the default item to be use if
|
| items | Array.<Item> | Indicates all the possible items. |
Example
{
key: "ratio",
default: "DefaultTile",
items : [
{
keyValue: "16:9"
item: "LandscapeItem"
},
{
keyValue: "4:3"
item: "PortraitItem"
}
]
}Item : Object
Definition of an Item for the chooser.
Kind: inner typedef of AbstractNativeRailElement
Properties
| Name | Type | Description |
|---|---|---|
| keyValue | string | Indicates value of the key of the chooser that needs to match with. |
| item | string | Indicates the name of the item in native rail. |
AbstractNativeRailElement
Kind: global class
- AbstractNativeRailElement
- new AbstractNativeRailElement()
- new AbstractNativeRailElement(properties)
- instance
- ._defineSettings()
- .getIndex() ⇒
Promise.<number> - .getItem(index) ⇒
Promise.<Object> - .setData(datas, index, chooser) ⇒
Promise - .scrollTo(index) ⇒
Promise.<Boolean> - ._getIndex() ⇒
Promise.<number> - ._setData(datas, index, chooser) ⇒
Promise - ._scrollTo(index) ⇒
Promise.<Boolean> - .onScroll(index, data)
- ._onScroll(index) ⇒
Promise - .onItemClicked(index, data)
- ._onItemClicked(index) ⇒
Promise
- inner
- ~ItemChooser :
Object - ~Item :
Object
- ~ItemChooser :
AbstractNativeRailElement()
Rail view that will use native component of the engine
Example
$AbstractNativeRailElement.declare("MyNativeRailElement", {
itemChooser: {
key: "ratio",
default: "DefaultTile",
items : [
{
keyValue: "16:9"
item: "LandscapeItem"
},
{
keyValue: "4:3"
item: "PortraitItem"
}
]
},
direction: $RailDirection.VERTICAL
});AbstractNativeRailElement(properties)
Create clean empty or predefined fields inside this rail element at startup.
| Param | Type | Description |
|---|---|---|
| properties | Object | Object holding defined parameters such as direction or itemChooser. |
_defineSettings()
Kind: instance method of AbstractNativeRailElement
getIndex() ⇒ Promise.<number>
Get the index of the current focused item
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<number> - index of the current “focused” item
getItem(index) ⇒ Promise.<Object>
Get the item data at the given index
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Object> - An object that matches the item data at the asked index
| Param | Type | Description |
|---|---|---|
| index | number | index of the element you want to retrieve |
setData(datas, index, chooser) ⇒ Promise
Set all datas to the rail.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| datas | Array.<Object> | List of data to be used for the rail |
| index | Number | Index of the focused item. Default is 0 |
| chooser | ItemChooser | ItemChooser can be passed here to change it |
scrollTo(index) ⇒ Promise.<Boolean>
Scroll to the item at the requested index.
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Boolean> - True if the item has been scrolledTo, false else (out of bound). If the item is already scrolled to, return false
| Param | Type | Description |
|---|---|---|
| index | Number | The index of the item you want to scroll to |
_getIndex() ⇒ Promise.<number>
Get the index of the current focused item
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<number> - index of the current “focused” item
Access: protected
_setData(datas, index, chooser) ⇒ Promise
Set all datas to the rail.
Kind: instance method of AbstractNativeRailElement
Access: protected
| Param | Type | Description |
|---|---|---|
| datas | Array.<Object> | List of data to be used for the rail |
| index | Number | Index of the focused item. Default is 0 |
| chooser | ItemChooser | ItemChooser can be passed here to change it |
_scrollTo(index) ⇒ Promise.<Boolean>
Scroll to the item at the requested index.
Kind: instance method of AbstractNativeRailElement
Returns: Promise.<Boolean> - True if the item has been scrolledTo, false else (out of bound). If the item is already scrolled to, return false
Access: protected
| Param | Type | Description |
|---|---|---|
| index | Number | The index of the item you want to scroll to |
onScroll(index, data)
Triggered each time an item has been focused.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| index | Number | Reached index |
| data | Object | The data at the given index |
_onScroll(index) ⇒ Promise
Connect to native trigger each time an item has been focused.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| index | Number | Reached index |
onItemClicked(index, data)
Triggered each time an item has been clicked on.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| index | Number | Reached index |
| data | Object | The data at the given index |
_onItemClicked(index) ⇒ Promise
Connect to native trigger each time an item has been clicked on.
Kind: instance method of AbstractNativeRailElement
| Param | Type | Description |
|---|---|---|
| index | Number | Reached index |
ItemChooser : Object
Define the chooser that will be needed to choose an item depending of the value of a specified key in data
Kind: inner typedef of AbstractNativeRailElement
Properties
| Name | Type | Description |
|---|---|---|
| key | string | Indicates the key id that will be used on data to choose the item. |
| default | string | Indicates the default item to be use if
|
| items | Array.<Item> | Indicates all the possible items. |
Example
{
key: "ratio",
default: "DefaultTile",
items : [
{
keyValue: "16:9"
item: "LandscapeItem"
},
{
keyValue: "4:3"
item: "PortraitItem"
}
]
}Item : Object
Definition of an Item for the chooser.
Kind: inner typedef of AbstractNativeRailElement
Properties
| Name | Type | Description |
|---|---|---|
| keyValue | string | Indicates value of the key of the chooser that needs to match with. |
| item | string | Indicates the name of the item in native rail. |
itemChooser
Kind: global variable
Properties
| Name | Type | Description |
|---|---|---|
| itemChooser | ItemChooser | Chooser to be used for the rail construction. (Could not be used at the same time as item) |
direction
Kind: global variable
Properties
| Name | Type | Description |
|---|---|---|
| direction | RailDirection | Should equal |