MFocus
MFocus ⇐ Trait
Make a view focus-able Indicates that the view is of interest and may receive inputs Multiple views can be focused if they are part of the same hierarchy
Kind: global mixin
Extends: Trait
Properties
| Name | Type | Description |
|---|---|---|
| hasFocus | Boolean | Feature flag |
| isFocused | Boolean | True if the view is currently focused |
| focusedChild | View | child that is (or was last) focused |
| routerManager | RouterManager | Instance of RouterManager |
- MFocus ⇐
Trait
focus([options])
Focus the view and update focused hierarchy Only one hierarchy can be possible
Kind: instance method of MFocus
| Param | Type | Description |
|---|---|---|
| [options] | Object | The options |
| [options.blurOptions] | Object | the blur options |
| [options.focusOptions] | Object | the focus options |
| [options.singletons] | Array.<Object> | the common views between 2 screens |
getFocusedChildren() ⇒ Array.<View>
Return the list of descendant that are focused
Kind: instance method of MFocus
Returns: Array.<View> - list of descendant that are focused
getFocusedHierarchyIds() ⇒ Array.<string>
Return the list of descendant ids that are focused
Kind: instance method of MFocus
Returns: Array.<string> - list of descendant ids that are focused
getFocusedHierarchyTestId() ⇒ Array
to override focusedHierarchyIds but for tests
Kind: instance method of MFocus
getTestId() ⇒ *
To get test id or id
Kind: instance method of MFocus
_getChildToFocus() ⇒ View
Returns the child that should be focused, following the focus of these view By default, returns the focusedChild, which is the child that is/was focused
Extension point - You can override these method
Kind: instance method of MFocus
Access: protected
_onFocusChanged(previousHierarchy, currentHierarchy, options)
Called following a focus that has changed the focused hierarchy
All the views _onFocusChanged methods of the old/new hierarchy are called, even if the view itself did not change its focus
Extension point - You can override these method
Kind: instance method of MFocus
Access: protected
| Param | Type | Description |
|---|---|---|
| previousHierarchy | Array.<Object> | The previous hierarchy |
| currentHierarchy | Array.<Object> | The current hierarchy |
| options | Object | The additionnal params |
_onFocus(options)
Called when focused Extension point - You can override these method
Kind: instance method of MFocus
Access: protected
| Param | Type | Description |
|---|---|---|
| options | Object | The additional params |
_onBlur(options)
Called when blurred Extension point - You can override these method
Kind: instance method of MFocus
Access: protected
| Param | Type | Description |
|---|---|---|
| options | Object | The additional options |