report/SessionStorageReporter. SessionStorageReporter

This JClic Reporter writes persistent data to the browser local session storage. It uses some of
the JClic Reports API.
Connection parameters (key, context...) are passed through the options element of JClicPlayer (acting as JClicPlayer).
Set storage=local in options to store reports in window.localStorage
instead of window.sessionStorage (default).

Constructor

new SessionStorageReporter(ps)

SessionStorageReporter constructor

Parameters:
NameTypeDescription
psmodule:JClicPlayer.JClicPlayer

The JClicPlayer used to retrieve settings and localized messages

Extends

  • module:reports/Reporter.Reporter

Members

descriptionDetail :string

Additional info to display after the reporter's description

Type:
  • string

descriptionKey :string

Description of this reporting system

Type:
  • string

key :string

Key used to save the report into sessionStorage

Type:
  • string

storage :external:Storage

Type of storage to be used. Defaults to window.sessionStorage

Methods

endActivity(score, numActions, solved)

This method should be called when the current activity finishes. Data about user's final results
on the activity will then be saved.

Parameters:
NameTypeDescription
scorenumber

The final score, usually in a 0-100 scale.

numActionsnumber

The total number of actions done by the user to solve the activity

solvedboolean

true if the activity was finally solved, false otherwise.

endSequence()

Finalizes the current sequence

init(optionsopt) → {external:Promise}

Initializes this report system with an optional set of parameters.
Returns a Promise, fulfilled when the reporter is fully initialized.

Parameters:
NameTypeAttributesDescription
optionsobject<optional>

Initial settings passed to the reporting system

Returns:
Type: 
external:Promise

saveCurrentReport()

Saves the current report data to sessionStorage