Constructor
new Section(id, title, icon, buttonTypeopt, closeMainPageOnHideopt, indexopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
String | section identifier |
|
title |
String | section title |
|
icon |
qui.icons.Icon | section icon |
|
buttonType |
String |
<optional> |
one of: |
closeMainPageOnHide |
Boolean |
<optional> |
set to |
index |
Number |
<optional> |
sets the section position (ordering) in relation with other sections; by default, sections are positioned based on their registration order |
- Mixes In:
- Source:
Methods
canClose() → {Boolean}
Override this method to prevent accidental closing of the section, to the possible extent. Sections can be closed by default.
A section is closed only when application window is closed or reloaded.
- Source:
Returns:
- Type
- Boolean
getCurrentPage() → (nullable) {qui.pages.PageMixin}
Return the current page of this section.
- Source:
Returns:
- Type
- qui.pages.PageMixin
getIcon() → {qui.icons.Icon}
Return the section icon.
- Source:
Returns:
- Type
- qui.icons.Icon
getId() → {String}
Return the id of this section.
- Source:
Returns:
- Type
- String
getInstance() → {Object}
Return the singleton instance. Instantiates the class on first call.
- Mixes In:
- Source:
Returns:
the instance
- Type
- Object
getInstance() → {Object}
Return the singleton instance. Instantiates the class on first call.
- Mixes In:
- Source:
Returns:
the instance
- Type
- Object
getMainPage() → (nullable) {qui.pages.PageMixin}
Return the main page of this section.
- Source:
Returns:
- Type
- qui.pages.PageMixin
getPagesContext() → (nullable) {qui.pages.PagesContext}
Return the pages context of this section.
- Source:
Returns:
getTitle() → {String}
Return the title of this section.
- Source:
Returns:
- Type
- String
handleHide() → {Promise}
Handle the event of section becoming hidden.
- Source:
Returns:
a promise that resolves if the section can be hidden and rejected otherwise
- Type
- Promise
handleRegister()
This method is called when qui.sections.register
is called on this section and is responsible of section
setting up after registration.
- Source:
handleShow(source, prevSectionnullable)
Handle the event of section becoming visible.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
source |
String | ||
prevSection |
qui.sections.Section |
<nullable> |
the previous section |
- Source:
handleUnregister()
This method is called when qui.sections.unregister
is called on this section and is responsible of
cleaning up after section removal.
- Source:
isCurrent() → {Boolean}
Tell if this section is the current section or not.
- Source:
Returns:
- Type
- Boolean
load() → {Promise}
Override this to implement how the section is loaded, after pushing the main page.
Loading the main page and loading the section may happen concurrently.
By default, returns a resolved promise.
- Source:
Returns:
- Type
- Promise
makeMainPage() → {qui.pages.PageMixin}
Override this method to create the main section page.
- Source:
Returns:
the section's main page
- Type
- qui.pages.PageMixin
navigate(path) → {qui.sections.Section|Promise.<qui.sections.Section>}
Override this to implement redirects from this section when switching to it using
qui.navigation.navigate
. By default it returns this section.
Parameters:
Name | Type | Description |
---|---|---|
path |
Array.<String> | the requested navigation path |
- Source:
Returns:
the new section
- Type
- qui.sections.Section | Promise.<qui.sections.Section>
onHide()
Called whenever the section is hidden.
- Source:
onOptionsBarOpenClose(opened)
Called when the options bar is opened or closed, while this section is the current section.
Parameters:
Name | Type | Description |
---|---|---|
opened |
Boolean |
|
- Source:
onReset()
Called whenever the section is reset.
- Source:
onScreenLayoutChange(smallScreen, landscape)
Called when the screen layout changes.
Parameters:
Name | Type | Description |
---|---|---|
smallScreen |
Boolean | whether the screen is now a small screen or not |
landscape |
Boolean | whether the screen layout is now landscape or portrait |
- Source:
onShow(source, prevSectionnullable)
Called whenever the section becomes visible.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
source |
String | the source why the section has been shown; known sources are:
|
|
prevSection |
qui.sections.Section |
<nullable> |
the previous section |
- Source:
onWindowActiveChange(active, active)
Called when the window becomes active or inactive.
Parameters:
Name | Type | Description |
---|---|---|
active |
Boolean | |
active |
- Source:
onWindowFocusedChange(focused, focused)
Called when the window becomes focused or unfocused.
Parameters:
Name | Type | Description |
---|---|---|
focused |
Boolean | |
focused |
- Source:
onWindowResize(width, height)
Called whenever the screen size changes.
Parameters:
Name | Type | Description |
---|---|---|
width |
Number | the new width of the screen |
height |
Number | the new height of the screen |
- Source:
preload() → {Promise}
Override this to implement how the section is preloaded (i.e. before pushing the main page).
During the preload execution, this section should not be assumed to be the current section. Preloading blocks navigation by blocking switching to this section.
By default, returns a resolved promise.
- Source:
Returns:
- Type
- Promise
pushPage(page, historyEntryopt) → {Promise}
Push a new page onto the section's context. The page is not guaranteed to be pushed by the time the function exists.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
page |
qui.pages.PageMixin | the page to be pushed |
||
historyEntry |
Boolean |
<optional> |
null | whether to create a new history entry for current page before adding the new
page, or not (determined automatically by default, using new page's |
- Source:
Returns:
a promise that resolves as soon as the page is pushed, or rejected if the page cannot be pushed
- Type
- Promise
reset() → {Promise}
Reset the section to its initial state, closing all pages, including the main page.
- Source:
Returns:
a promise that is resolved as soon as the section is reset and the main page is loaded
- Type
- Promise
setButtonVisibility(visible)
Show or hide the section button.
Parameters:
Name | Type | Description |
---|---|---|
visible |
Boolean |
- Source:
setIcon(icon)
Set the section icon.
Parameters:
Name | Type | Description |
---|---|---|
icon |
qui.icons.Icon | the new icon |
- Source:
setTitle(title)
Set the title of this section.
Parameters:
Name | Type | Description |
---|---|---|
title |
String |
- Source:
setup(…args)
Prepare the class for instantiation, establishing the constructor arguments.
Any arguments passed to this method will be passed to the constructor, when creating the singleton.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
arguments to be passed to the constructor |
- Mixes In:
- Source:
setup(…args)
Prepare the class for instantiation, establishing the constructor arguments.
Any arguments passed to this method will be passed to the constructor, when creating the singleton.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
arguments to be passed to the constructor |
- Mixes In:
- Source:
whenLoaded() → {Promise}
Return a promise that settles as soon as the section is loaded.
This method calls qui.sections.Section#load
once per section instance.
A loaded section can also be assumed to be preloaded.
- Source:
Returns:
- Type
- Promise
whenPreloaded() → {Promise}
Return a promise that settles as soon as the section is preloaded.
This method calls qui.sections.Section#preload
once per section instance.
- Source:
Returns:
- Type
- Promise