JSAPI page » History » Version 21
« Previous -
Next » -
eddy ed, 06/04/2017 11:19 AM
The page object¶
If type is 'directory' this can be used to hint the UI what type of items is being displayed so the UI can chose a way to layout the items.
It can be set like this:
page.model.contents = 'yourType';
yourType can be one from the list:
grid : preffer to represent the page as a grid
list : (mostly default) preffer to represent the page as a list
Set to true if the page is loading. This is the default value. When set to true the user interface will display a throbber or similar animation telling the user that loading is in progress. Should be set to false by the plugin once the page have been filled with data.
Source URL for video content. Only relevant if page.type is set to "video"
Metadata of the current page.
Some keys most used are:
title: Title of the current page
logo: Image that identifies the current page
glwview: Path to a view file that defines the UI for the current page
background: Background of the current page
backgroundAlpha: You can set background's alpha channel (on platforms where it's available) eg backgroundAlpha = 0.5
backgroundAvailable: You can disable/enable background. eg backgroundAvailable=true
font: You can change font of the items on the page
Gives access to the object which has functions to add options to the page menu. For the functions list refer to the Settings object.
Number of total entries on the page when all items have been inserted. This is a must to be set in addSearcher or it will return no results even if you append items to the page by appendItem. Also it should be initialised on searcher entry as not on all platforms value is 0 on loading.
Note: A positive value in a Searcher means there are results, while 0 means there are no search results and so Movian should not add the Searcher.
If a function is assigned to this property, that function will be invoked when Movian wants more items appended to the data model for, so called, paginated loading. If this property is not set Movian will assume that the plugin populates the entire model during the initial page load.
Available since 4.9.105.
If a function is assigned to this property, that function will be invoked whenever an item of the pages changes position.
Redirects URI call to another URI.
appendItem(String URI, [String type], [Object metadata])¶
Append an item to the page. This should be used to populate data when page.type == 'directory'
- URI - URI to be opened when the item is activated (clicked)
- type - Type of the item
- directory - Directory that can be browsed
- file - Any type of file or unknown file format
- video - Video file
- audio - Audio track
- image - Image that can be displayed
- album - Collection of audio tracks
- station - Icecast/shoutcast music station (see di.fm plugin for example)
- metadata - Additional information about the item
Depending on the type of item, different information will be visible:
video : following properties are displayed
directory : following properties are displayed
item : following properties are displayed
Returns the item object
appendPassiveItem(String type, [Variable data], [Object metadata])¶
Appends so called, passive item to the page. These items are only used for informational purposes.
appendAction(String type, String data, [Boolean enabled], [Object metadata])¶
Appends so called action item to the page. To display properly, do page.type = 'items'.
If 'type' 'navopen' then data URI (it opens URI this way. If 'type' == 'pageevent' then 'data' is event name and it is used together with page.onEvent function.
onEvent(String Event, Function Handler)¶
Install an event handler for the current page. If event is 'null' all events will be passed to the handler. The first argument to the handler is a string with the event name.
- Event - Name of the event to associate to the handler.
- Handler - Function to be executed when event is called.
Removes all items of the current page.
A helper to switch the page in error mode and display the supplied error message.
Prints dump of the property tree representing the page to the console (used while debugging plugins).
Returns object via which you can manipulate by items residing on the page.
Some properties are:
id: id of the item