Items API Methods
getTime()
Returns the current elapsed time, in seconds, for the assessment.
You would want to use this method so that you can show a popup dialog window for the learner at a specific time in the assessment, when they have 30 seconds left, for example.
Important This method only works when the rendering_type
initialization option is set to "assess"
.
Examples
var currentTime = itemsApp.getTime();
console.log(currentTime);
Arguments
-
options object
-
currentSection boolean
When using sections in the assessment player, passing
true
will return the elapsed time of the current active section.
-
Return value
Type integer
Current elapsed time of the assessment in seconds.
Caveats
When using sections
configured with different time
options, the returned value is the total elapsed time of all sections combined.
Related articles
- The
time
initialization option, used to configure all time related settings for the assessment. - The
time:change
event, the event that fires once every second while the assessment is not paused. - The
time:end
event, the event that fires when the assessment'smax_time
has elapsed.