SipaOnsenPage
SipaOnsenPage
SipaOnsenPage
Tool class with page loader with included router for OnsenUI
- SipaOnsenPage
- .config :
SipaOnsenPageConfig
- .load(page_id, options)
- .extractIdOfTemplate(template, options) →
string
- .getClassNameOfTemplate(template, options) →
string
- .typeOptions(type) →
TypeOptionsType
- .currentPageId() →
string
- .currentPageClass() →
SipaBasicView
- .currentLayoutId() →
string
- .loadLayout(layout_id, options)
- .callMethodOfPage(page_id, method_name, parameters)
- .callMethodOfLayout(layout_id, method_name, parameters)
- .setConfig(config)
- .popPage(options) →
Promise
- .addStatusBarMock()
- .removeStatusBarMock()
- ._initStatusBarMock()
- .reset()
- .OnsenOptions :
Object
- .config :
SipaOnsenPage.config : SipaOnsenPageConfig
Kind: static property of SipaOnsenPage
SipaOnsenPage.load(page_id, options)
Load given page by page_id
Param | Type | Default | Description |
---|---|---|---|
page_id | string | to load | |
options | Object | ||
options.reset | boolean | false | reset page to given page |
options.replace | boolean | false | replace current page with given page. If reset=true is set, this option will be ignored |
options.push | boolean | false | stack given page over current page, independent if it exists already. If reset=true or replace=true is set, this option will be ignored |
options.onsen | OnsenOptions | options passed to original OnsenUI bringPageTop / pushPage / replacePage / resetPage | |
options.init_history_tree | boolean | false | force to load history tree, default false |
options.params | Object | parameters to be set at the new page | |
options.keep_params | boolean | true | keep parameters when loading other page |
options.anchor | string | anchor to be set at the new page | |
options.keep_anchor | boolean | false | keep current anchor when loading other page |
options.remove_params | Array.<String> | parameters to be removed at the new page | |
options.success | function | function to be called after successful loading | |
options.error | function | function to be called after loading fails | |
options.always | function | function to be called always after successful/erroneous loading |
SipaOnsenPage.extractIdOfTemplate(template, options) → string
Get the id only of the given template
Returns: string
- absolute path
Param | Type | Default | Description |
---|---|---|---|
template | string | id or path of page or layout | |
options | Object | ||
options.type | SipaPage.PageType | 'page' |
SipaOnsenPage.getClassNameOfTemplate(template, options) → string
Get the class name of the given template
Returns: string
- class name
Param | Type | Default | Description |
---|---|---|---|
template | string | id or path of page or layout | |
options | Object | ||
options.type | SipaPage.PageType | 'page' |
SipaOnsenPage.typeOptions(type) → TypeOptionsType
Get the options of the given type
Returns: TypeOptionsType
- type options
Param | Type |
---|---|
type | SipaPage.PageType |
SipaOnsenPage.currentPageId() → string
Get page id of current loaded page
Returns: string
- page id
SipaOnsenPage.currentPageClass() → SipaBasicView
Get current page class
SipaOnsenPage.currentLayoutId() → string
Get layout id of current loaded layout
SipaOnsenPage.loadLayout(layout_id, options)
Load the given layout
Param | Type | Default | Description |
---|---|---|---|
layout_id | string | to load | |
options | Object | ||
options.fade_effect | boolean | true | fade effect on layout change |
options.keep_page | boolean | false | keep the loaded page, but change the layout only |
SipaOnsenPage.callMethodOfPage(page_id, method_name, parameters)
Call the given method of the given page with given parameters (optional)
Param | Type |
---|---|
page_id | string |
method_name | string |
parameters | Array |
SipaOnsenPage.callMethodOfLayout(layout_id, method_name, parameters)
Call the given method of the given layout with given parameters (optional)
Param | Type |
---|---|
layout_id | string |
method_name | string |
parameters | Array |
SipaOnsenPage.setConfig(config)
Set the configuration of pages and layouts
Param | Type |
---|---|
config | Object |
config.default_layout | string |
config.default_layouts | Object |
Example
SipaOnsenPage.setConfig({
// default layout for all pages
default_layout: 'default',
// specific layouts for some pages { <page-name>: <layout-name> }
default_layouts: {
// overwrites the layout for the page 'login-page' with layout 'mini-dialog'
'login-page': 'mini-dialog'
}
});
SipaOnsenPage.popPage(options) → Promise
Kind: static method of SipaOnsenPage
Param | Type | Description |
---|---|---|
options | Object | |
options.onsen | OnsenOptions | options passed to original OnsenUI popPage |
SipaOnsenPage.addStatusBarMock()
Add a status bar mock to the app
SipaOnsenPage.removeStatusBarMock()
Remove status bar mock of the app
SipaOnsenPage._initStatusBarMock()
Initialize status bar mock - do not run before first page is loaded!
SipaOnsenPage.reset()
Reset all states
Useful for unit testing
SipaOnsenPage.OnsenOptions : Object
Kind: static typedef of SipaOnsenPage
Param | Type | Description |
---|---|---|
animation | 'slide' | 'lift' | 'fade' | 'none' | 'slide-ios' | 'lift-ios' | 'fade-ios' | 'slide-md' | 'lift-md' | 'fade-md' | Animation name. Available animations are "slide", "lift", "fade" and "none". These are platform based animations. For fixed animations, add "-ios" or "-md" suffix to the animation name. E.g. "lift-ios", "lift-md". Defaults values are "slide-ios" and "fade-md". |
animationOptions | Object | Specify the animation’s duration, delay and timing. E.g. {duration: 0.2, delay: 0.4, timing: 'ease-in'}. |
animationOptions.duration | number | |
animationOptions.delay | number | |
animationOptions.timing | string | |
callback | function | Function that is called when the transition has ended. |
data | Object | Custom data that will be stored in the new page element. |
times | number | Number of pages to be popped. Only one animation will be shown. Works only on popPage |
page | string | Only necessary if no page is given. |
pageHTML | string | HTML code that will be computed as a new page. Overwrites page parameter. |
TypeOptionsType : Object
Custom type definitions for excellent IDE auto complete support Properties
Name | Type |
---|---|
prefix | string |
file_ext | string |
SipaOnsenPageConfig : Object
Kind: global typedef
Param | Type |
---|---|
default_layout | string |
default_layouts | Object |