SessionStorageReporter

Extends: module:reports/Reporter.Reporter

Source: SessionStorageReporter.js:42

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]https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
instead of [window.sessionStorage]https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage (default).


Constructor

new SessionStorageReporter( ps: module:JClicPlayer.JClicPlayer, ): SessionStorageReporter

SessionStorageReporter constructor

Parameters


Instance Methods

init(options?: object): external:Promise

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

Parameters

  • options (object, optional) — Initial settings passed to the reporting system

Returns

saveCurrentReport()

Saves the current report data to sessionStorage

endSequence()

Finalizes the current sequence

endActivity(score: number, numActions: number, solved: boolean)

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

Parameters

  • score (number) — The final score, usually in a 0-100 scale.
  • numActions (number) — The total number of actions done by the user to solve the activity
  • solved (boolean) — true if the activity was finally solved, false otherwise.

Instance Fields

storage: external:Storage

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

descriptionKey: string

Description of this reporting system

descriptionDetail: string

Additional info to display after the reporter's description

key: string

Key used to save the report into sessionStorage