PlayerServices can be used to call a function on player runtime
Function | Description |
---|---|
getPresentation() | Return object which represents a presentation. This object implements several functions related to accessing the presentation and its pages. |
getCurrentPageIndex() | Return index of a current page. |
getCommands() | Return object which implements different commands you can call from your addon. |
getEventBus() | Return object which implements event bus. |
getScore() | Return object which implements commands for accessing the player score. |
getModule(moduleID) | Return module presenter based on the given ID. |
getTextParser() | Return object which is a parser for text elements like definition links. |
getStaticFilesPath() | Returns path to static files included with the player. |
isBook() | Returns true is player is in book mode (shows 2 pages). |
hasCover() | Returns true if first page is shown always as single page. |
Function | Description |
---|---|
getPageCount() | Return number of pages. |
getPage(index) | Return page at given index. |
getTableOfContents() |
Return hierarchical table of contents which consists of Chapters and Pages.
Chapter has the following methods:
|
Function | Description |
---|---|
getId() | Return page id. |
getName() | Return page name. |
getBaseURL() | Return page base URL with slash '/' at the end. |
isReportable() | Return true if page contains should be included in lesson report. |
getModules() | Returns list of ids of all modules on the page. |
Function | Description |
---|---|
executeEventCode(code) | Send the script code to be executed by player |
gotoPage(name) | Go to page with a given name. |
gotoPageIndex(index) | Go to page at given index. |
getTimeElapsed() | Returns time in seconds elapsed form the start of the lesson session. |
checkAnswers() | Sets the presentation to showErrorsMode. |
uncheckAnswers() | Restores the presentation to workMode. |
Function | Description |
---|---|
addEventListener(event_name, listener) | Register the listener for a specific event. Listener is the object which implements:
onEventReceived(eventName, eventData) function.
|
sendEvent('ItemSelected', data); | Send event
|
Function | Description |
---|---|
getMaxScore() | Return max score for the whole presentation |
getTotalScore() | Return score calculated for all opened pages. |
getPageScore(pageName) (depreciated) |
Return score for a given page. The score is hashmap with values:
|
getPageScoreById(pageId) |
Return score for a given page. The score is hashmap with values:
|
Function | Description |
---|---|
parse(text) | Parse given text and replace definition \def{word} with links |
connectLinks(element); | Connect all definition links to event bus. Each link will send Definition event. |