Skip to content

Commit d0160ca

Browse files
author
Mark Statkus
committed
added a resume event for those that want to ask.
1 parent 2587878 commit d0160ca

File tree

3 files changed

+36
-35
lines changed

3 files changed

+36
-35
lines changed

QUnit-Tests/js/scorm/SCOBot.js

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*global $, SCOBotUtil, scorm, window */
2-
/*jslint browser: true, devel: true, indent: 4 regexp: true*/
2+
/*jslint browser: true, devel: true, indent: 4, regexp: true*/
33
/**
44
* SCOBot
55
* This only works with the SCOBotBase and will not work standalone. It will not work standalone (without a LMS)
@@ -37,19 +37,19 @@
3737
* behaves after Terminate is fired. The default behavior is _none_, however if you seek more information about the
3838
* other possibilities you can locate a SCORM_SeqNav.pdf from ADL in Table 5.6.6a for more detailed info.
3939
*
40-
* @event exception, load, unload, message, continue, comments_lms
40+
* @event exception, load, unload, message, continue, comments_lms, resume
4141
*
4242
* @author Cybercussion Interactive, LLC <info@cybercussion.com>
43-
* @license Copyright (c) 2009-2016, Cybercussion Interactive LLC
43+
* @license Copyright (c) 2009-2017, Cybercussion Interactive LLC
4444
* As of 3.0.0 this code is under a Creative Commons Attribution-ShareAlike 4.0 International License.
4545
* @requires SCOBotBase, SCOBotUtil
46-
* @version 4.1.5
46+
* @version 4.1.6
4747
* @param options {Object} override default values
4848
* @constructor
4949
*/
5050
/*!
51-
* SCOBot, Updated Jan 1st, 2016
52-
* Copyright (c) 2009-2016, Cybercussion Interactive LLC. All rights reserved.
51+
* SCOBotBase, Updated Jan 1st, 2016
52+
* Copyright (c) 2009-2017, Cybercussion Interactive LLC. All rights reserved.
5353
* As of 3.0.0 this code is under a Creative Commons Attribution-ShareAlike 4.0 International License.
5454
*/
5555
function SCOBot(options) {
@@ -58,9 +58,9 @@ function SCOBot(options) {
5858
/** @default version, createDate, modifiedDate, prefix, launch_data, interaction_mode, success_status, location, completion_status, suspend_data, mode, scaled_passing_score, totalInteractions, totalObjectives, startTime */
5959
var Utl = SCOBotUtil, // Hook for jQuery 'like' functionality
6060
defaults = {
61-
version: "4.1.5",
61+
version: "4.1.6",
6262
createDate: "04/07/2011 09:33AM",
63-
modifiedDate: "03/04/2016 12:23AM",
63+
modifiedDate: "05/10/2017 05:03PM",
6464
prefix: "SCOBot",
6565
// SCOBot default parameters
6666
launch_data: {},
@@ -84,7 +84,7 @@ function SCOBot(options) {
8484
mode: "", // will be replaced by LMS value
8585
scaled_passing_score: 0.7, // Override for default unless imsmanifest (LMS) has value
8686
completion_threshold: 0, // Override for default unless imsmanifest (LMS) has value
87-
max_time_allowed: '', // will be replaced by LMS value
87+
max_time_allowed: "", // will be replaced by LMS value
8888
totalInteractions: 0, // See setTotals below
8989
totalObjectives: 0,
9090
startTime: 0
@@ -93,25 +93,25 @@ function SCOBot(options) {
9393
settings = Utl.extend(defaults, options),
9494
// 4.0.4 Status/State Buffer Private now to prevent direct tampering
9595
buffer = {
96-
success_status : '',
97-
completion_status : '',
96+
success_status : "",
97+
completion_status : "",
9898
completion_threshold: settings.completion_threshold, // cache
99-
progress_measure : '0',
99+
progress_measure : "0",
100100
scaled_passing_score: settings.scaled_passing_score, // cache
101101
score : {
102-
scaled: '0',
103-
raw : '0',
104-
min : '0',
105-
max : '0'
102+
scaled: "0",
103+
raw : "0",
104+
min : "0",
105+
max : "0"
106106
}
107107
},
108-
lmsconnected = 'false',
108+
lmsconnected = "false",
109109
isError = false,
110110
isStarted = false,
111111
happyEndingRequest = false, // if you enable happyEnding, and call it, it will take precedence.
112112
SCOBotManagedStatus = false, // if you setTotals, SCOBot will manage the status.
113-
badValues = '|null|undefined|false|NaN|| |',
114-
error = scorm.get('error'), // no sense retyping this
113+
badValues = "|null|undefined|false|NaN|| |",
114+
error = scorm.get("error"), // no sense retyping this
115115
self = this; // Hook
116116
// End Constructor ////////
117117
///////////////////////////
@@ -125,14 +125,13 @@ function SCOBot(options) {
125125
scorm.debug(error[n], 2);
126126
return true;
127127
}
128-
129128
/**
130129
* Trigger Exception
131130
* Throws an event the player can listen to in order to handle an exception.
132131
* This would be common to a non-compliance in an LMS and loss of student data.
133132
*/
134133
function triggerException(msg) {
135-
Utl.triggerEvent(self, 'exception', {error: msg});
134+
Utl.triggerEvent(self, "exception", {error: msg});
136135
}
137136
/**
138137
* Initialize SCO
@@ -144,7 +143,7 @@ function SCOBot(options) {
144143
function initSCO() {
145144
lmsconnected = scorm.initialize(); // returns string
146145
scorm.debug(settings.prefix + ": SCO Loaded from window.onload " + lmsconnected, 4);
147-
if (lmsconnected === 'true') {
146+
if (lmsconnected === "true") {
148147
self.start(); // Things you'd do like getting mode, suspend data
149148
Utl.triggerEvent(self, "load");
150149
} else {
@@ -166,7 +165,7 @@ function SCOBot(options) {
166165
scorm.debug(settings.prefix + ": SCO is being unloaded, forcing exit ...", 3);
167166
if (scorm.isConnectionActive()) {
168167
Utl.triggerEvent(self, "unload");
169-
switch (scorm.get('exit_type')) {
168+
switch (scorm.get("exit_type")) {
170169
case "finish":
171170
self.finish();
172171
break;
@@ -216,7 +215,7 @@ function SCOBot(options) {
216215
*/
217216
function isISO8601(v) {
218217
var iso8601Exp;
219-
switch (scorm.get('time_type')) {
218+
switch (scorm.get("time_type")) {
220219
case "UTC": // AT GMT
221220
iso8601Exp = /^(\d{4})-0?(\d+)-0?(\d+)[T ]0?(\d+):0?(\d+):0?(\d+)(?:\.(\d+))(|Z)$/;
222221
break;
@@ -248,7 +247,7 @@ function SCOBot(options) {
248247
*/
249248
function notStartedYet() {
250249
scorm.debug(settings.prefix + ": You didn't call 'start()' yet, or you already terminated, ignoring.", 2);
251-
return 'false';
250+
return "false";
252251
}
253252

254253
/**
@@ -588,7 +587,7 @@ function SCOBot(options) {
588587
*/
589588
case 'numeric':
590589
if (typeof value === "number") {
591-
str = '' +value;
590+
str = '' + value;
592591
} else if (Utl.isPlainObject(value)) {
593592
arr = [trueRound(value.min, 7), trueRound(value.max, 7)];
594593
str = arr.join("[:]");
@@ -1089,7 +1088,9 @@ function SCOBot(options) {
10891088
scorm.debug(settings.prefix + ": Returning suspend data object from a prior session", 4);
10901089
/* you may not be using JSON suspend data, and managing that yourself. */
10911090
settings.suspend_data = settings.useJSONSuspendData ? JSON.parse(settings.suspend_data) : settings.suspend_data; // Turn this back into a object.
1091+
// 5/10/17 - event to trigger option for handling prior suspend data (Yes/No)
10921092
scorm.debug(settings.suspend_data, 4);
1093+
Utl.triggerEvent(self, 'resume', {suspend_data: settings.suspend_data}); // You would need to pop a modal dialog if you want to reset suspend data if the user says no.
10931094
if (settings.entry === "") {
10941095
settings.entry = "resume";
10951096
} // most definitely its a resume if there is suspend data.

QUnit-Tests/js/scorm/SCOBotBase.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
* @event debug, getvalue, setvalue, exception, terminated, StoreData
3636
*
3737
* @author Cybercussion Interactive, LLC <info@cybercussion.com>
38-
* @license Copyright (c) 2009-2016, Cybercussion Interactive LLC
38+
* @license Copyright (c) 2009-2017, Cybercussion Interactive LLC
3939
* As of 3.0.0 this code is under a Creative Commons Attribution-ShareAlike 4.0 International License.
40-
* @version 4.1.5
40+
* @version 4.1.6
4141
* @param options {Object} override default values
4242
* @constructor
4343
*/
4444
/*!
4545
* SCOBotBase, Updated Jan 1st, 2016
46-
* Copyright (c) 2009-2016, Cybercussion Interactive LLC.
46+
* Copyright (c) 2009-2017, Cybercussion Interactive LLC.
4747
* As of 3.0.0 this code is under a Creative Commons Attribution-ShareAlike 4.0 International License.
4848
*/
4949
function SCOBotBase(options) {
@@ -52,7 +52,7 @@ function SCOBotBase(options) {
5252
// Please edit run time options or override them when you instantiate this object.
5353
var Utl = SCOBotUtil,
5454
defaults = {
55-
version: "4.1.5",
55+
version: "4.1.6",
5656
createDate: "04/05/2011 08:56AM",
5757
modifiedDate: "03/04/2016 12:24AM",
5858
debug: false,
@@ -1138,7 +1138,7 @@ function SCOBotBase(options) {
11381138
lat = self.checkLatency(),
11391139
speed = lat > 0.40 ? "slow" : "fast";
11401140
// Write out existing LMS latency
1141-
debug(settings.prefix + " Tip: Current LMS Latency is " + lat + "ms which is " + speed + ".");
1141+
debug(settings.prefix + " Tip: Current LMS Latency is " + lat + "ms which is " + speed + ".", 3);
11421142
// Clear current latency
11431143
settings.latency_arr = [];
11441144
session_secs = (saveDate.getTime() - settings.startDate.getTime()) / 1000;

QUnit-Tests/js/scorm/SCOBot_API_1484_11.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@
1717
* @event StoreData
1818
*
1919
* @author Cybercussion Interactive, LLC <info@cybercussion.com>
20-
* @license Copyright (c) 2009-2016, Cybercussion Interactive LLC
20+
* @license Copyright (c) 2009-2017, Cybercussion Interactive LLC
2121
* As of 3.0.0 this code is under a Creative Commons Attribution-ShareAlike 4.0 International License.
2222
* @requires SCOBotUtil, SCOBotBase
23-
* @version 4.1.5
23+
* @version 4.1.6
2424
* @param options {Object} override default values
2525
* @constructor
2626
*/
2727
/*!
2828
* Local_API_1484_11, Updated January 1st, 2016
29-
* Copyright (c) 2009-2016, Cybercussion Interactive LLC.
29+
* Copyright (c) 2009-2017, Cybercussion Interactive LLC.
3030
* As of 3.0.0 this code is under a Creative Commons Attribution-ShareAlike 4.0 International License.
3131
*/
3232
function SCOBot_API_1484_11(options) {
3333
// Constructor
3434
"use strict";
3535
var Utl = SCOBotUtil,
3636
defaults = {
37-
version: "4.1.5",
37+
version: "4.1.6",
3838
createdate: "07/17/2010 08:15AM",
3939
moddate: "03/04/2016 12:24PM",
4040
prefix: "SCOBot_API_1484_11",

0 commit comments

Comments
 (0)