Basic application pages management support. This support is useful for obtaining all pages or the particular page instance registered in the opened application.
This is one of the base modules used in ABCS if you are going to work with pages.
- Version:
- 16.3.5
- Source:
Methods
getHomepageId() → {String}
stable API
Gets the Page's ID of the homepage.
Every ABCS application has defined single Page which is used as the homepage. Homepage means that if the ABCS application is opened without route to specific page, the homepage is opened first then.
- Version:
- 16.3.5
- Source:
Returns:
homepage's ID
- Type
- String
Example
// gets page's ID of the homepage
var homepageId = Pages.getHomepageId();
// gets the page instance by its ID
var page = Pages.getPage(homepageId);
// show notification in the ABCS's UI
Abcs.UI().showNotification(Abcs.UI().Notification.create({
message: 'Your homepage is called \'' + page.getDisplayName() + '\'.'
});
getPage(pageId) → {pages.dt/js/api/Page}
stable API
Gets the Page for the given ID.
If the ID is not available in the list of all application's pages,
undefined
value is returned.
Parameters:
Name | Type | Description |
---|---|---|
pageId |
String | ID of the page to obtain |
- Version:
- 16.3.5
- Source:
Returns:
page instance for supplied ID if such
Page exists, undefined
otherwise
- Type
- pages.dt/js/api/Page
Example
// gets page's ID of the homepage
var homepageId = Pages.getHomepageId();
// gets the page instance by its ID
var page = Pages.getPage(homepageId);
// show notification in the ABCS's UI
Abcs.UI().showNotification(Abcs.UI().Notification.create({
message: 'Your homepage is called \'' + page.getDisplayName() + '\'.'
});
getPages() → {Array.<pages.dt/js/api/Page>}
stable API
Gets list of existing pages in the ABCS application.
- Version:
- 16.3.5
- Source:
Returns:
list of all application's pages
- Type
- Array.<pages.dt/js/api/Page>
Example
// synchronous access used to make the sample more readable,
// you should always use async define for getting Pages
var Pages = require('pages.dt/js/api/Pages');
var ids = [];
// gets all pages
var pages = Pages.getPages();
// iterates through pages and collects their IDs
pages.forEach(function(page) {
ids.push(page.getId();
});
// prints the all pages IDs
console.log('Pages of your application are: ' + JSON.stringify(ids));