Module: standardPlayer/ComponentContext

This is the main context, that will be received by a SmartComponent instance as the 'context' parameter.

Members

<inner> device :Object

This context provides information about the current device.

Type:
  • Object
See:

<inner> page :Object

This object provides methods to handle wbt functionality according to a page.

Type:
  • Object
See:

<inner> quiz :Object

This object provides methods to handle quiz results.

Type:
  • Object
See:

<inner> stage :Object

This object provides methods to handle wbt functionality according to the stage, like page sequencing and navigation.

Type:
  • Object
See:

Methods

<inner> getApiVersion() → {object}

Gets the SmartComponent API version.

Returns:

version object.

Type
object

<inner> getChildren() → {Array.<HTMLElement>}

Gets an array of the elements, that are attached as children (document editor).

Returns:

shell element.

Type
Array.<HTMLElement>

<inner> getElement(selector) → {html}

Gets the shell element. Append your SmartComponent-DOM to this element as a child.

Parameters:
Name Type Argument Description
selector string <optional>

for child elements, 'null' for the component element.

Returns:

shell element.

Type
html

<inner> getPath() → {string}

Gets the path to the component files.

Returns:

file path

Type
string

<inner> getPlayerName() → {string}

Gets the name of the SmartComponent player.

Returns:

"standard" for the standard player or "html5" for the HTML5 player

Type
string

<inner> getPositioningElement() → {HTMLElement}

Gets the element for positioning the SmartComponent.
This element can be used to set and get positions for the component.
The content, classes and attributes should not be changed.

Returns:

positioning element.

Type
HTMLElement