Module: playerapi/page/PageQuizContext

This context provides methods to use components as quiz objects.

Members

<inner> event :Object

This object provides methods to handle events in the quiz object scope.

Type:
  • Object
See:

Methods

<inner> add(component, groupId, isCorrectSelectionRequired)

Adds a component as a quiz object (e.g. Multiple Choice or Drag&Drop element) to the current quiz page context.

The following event callbacks will be registered automatically if the stated component provides the according methods:


  • module:playerapi/page/PageQuizEventContext#bindOnEvaluateTestRun

  • module:playerapi/page/PageQuizEventContext#bindOnUserSolution

  • module:playerapi/page/PageQuizEventContext#bindOnBestPracticeSolution

Parameters:
Name Type Description
component Object

A component.

groupId String

The group id.

isCorrectSelectionRequired Boolean

Determine thats the component must be selected (true) for a correct answer or not (false).

<inner> evaluate()

Evaluates the quiz. Only available on quiz pages.

<inner> getQuestion() → {Object}

Gets the context for the page question .

Returns:

The question context. 'null' if the page has no quiz question.

Type
Object

<inner> getQuestionMetadata() → {Object}

Gets the context for the page question .

Returns:

The question context. 'null' if the page has no quiz question.

Type
Object

<inner> hasQuestion() → {Boolean}

Checks the page for a quiz question.

Returns:

true if the page has a question, otherwise false.

Type
Boolean

<inner> setSelected(component, isSelected)

Sets the selected state of a quiz object.

Parameters:
Name Type Description
component Object

A component.

isSelected boolean

Sets the selected state.

<inner> switchToBestPracticeSolution()

Switches to the best practice result. Only available on quiz pages.

<inner> switchToUserSolution()

Tells the TTKF Player to switch to the user solution mode. As a result, the player sends
the onUserSolution event and will displaying the result for the current quiz page.
Only available on quiz pages.