SipaPage
SipaPage
SipaPage
Tool class with page loader with included router
- SipaPage
- .config :
SipaPageConfig
- .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)
- .initHistoryState()
- .stackHistoryState(state, replace_state)
- .setConfig(config)
- .reset()
- .PageType :
Object
- .config :
SipaPage.config : SipaPageConfig
Kind: static property of SipaPage
SipaPage.load(page_id, options)
Load given page by page_id
Param | Type | Default | Description |
---|---|---|---|
page_id | string | to load | |
options | Object | ||
options.layout_id | string | specify custom layout, overwrite default layout | |
options.force_load | boolean | false | force to load the page again, even if it is already loaded |
options.fade_effect | boolean | true | use fade effect for the page container |
options.stack_page | boolean | true | stack page in page history |
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 |
SipaPage.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 | PageType | 'page' |
SipaPage.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 | PageType | 'page' |
SipaPage.typeOptions(type) → TypeOptionsType
Get the options of the given type
Returns: TypeOptionsType
- type options
Param | Type |
---|---|
type | PageType |
SipaPage.currentPageId() → string
Get page id of current loaded page
Returns: string
- page id
SipaPage.currentPageClass() → SipaBasicView
Get current page class
SipaPage.currentLayoutId() → string
Get layout id of current loaded layout
SipaPage.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 |
SipaPage.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 |
SipaPage.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 |
SipaPage.initHistoryState()
Initialize the router for single page app browser history
SipaPage.stackHistoryState(state, replace_state)
Stack the current page and layout state to the browser history
Param | Type | Default |
---|---|---|
state | Object | |
state.page_id | string | |
state.layout_id | string | |
state.options | Object | |
replace_state | boolean | false |
SipaPage.setConfig(config)
Set the configuration of pages and layouts
Param | Type |
---|---|
config | SipaPage.Config |
Example
SipaPage.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'
}
});
SipaPage.reset()
Reset all states
Useful for unit testing
SipaPage.PageType : Object
Custom type definitions for excellent IDE auto complete support
Param | Type |
---|---|
default_layout | string |
default_layouts | Object |
keep_anchor | boolean |
Properties
Name | Type |
---|---|
prefix | string |
file_ext | string |