Skip to content

Commit e67239c

Browse files
committed
2020 update, 'nolms' event for alert, modal, toast
1 parent 1ec13d8 commit e67239c

File tree

12 files changed

+1055
-1046
lines changed

12 files changed

+1055
-1046
lines changed

QUnit-Tests/js/scorm.bot.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

QUnit-Tests/js/scorm.bot.pack.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

QUnit-Tests/js/scorm/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ This project was broke down originally to encompass an entire functioning SCO wi
44

55
These files are the main formatted source code for the SCOBot Content API. Per the documentation you can mix and match which files you use in your project. You may use them all, or include them in your own build processes.
66

7-
##SCOBotUtil
7+
## SCOBotUtil
88
This now includes an event system and other utilitiy methods used by the library. Since it was too difficult to expand this to more libraries without relying on these features, they are now baked in. No dependancies on jQuery or any other framework/library.
99

10-
##SCOBotBase
10+
## SCOBotBase
1111
This is the bare minimum for establishing a connection to the lms, and providing the backwards compatibilty with both SCORM 1.2 and SCORM 2004. If you only use this file, your choosing to manage interacting with SCORM directly.
1212

13-
##SCOBot
13+
## SCOBot
1414
This automates the sequence doing typical load, initialize, checking mode, entry, suspend data and more. Creates friendly missing API's from the SCORM communication standard that makes setting objectives and interactions much easier. Baked in is a load, and unload event which will manage common tasks all SCO's must do. Also allows you to simply call happyEnding() to auto score your content. You can even take advantage of letting SCOBot score your objectives for you.
1515

16-
##SCOBot_API_1484_11
16+
## SCOBot_API_1484_11
1717
This is a local (simple) skeleton of the SCORM 2004 Runtime API. This mainly serves the purpose of allowing you to work offline and view console messages related to the communication standard of SCORM. Keep in mind this is only SCORM 2004's base API and does not include things like the Sequence and Navigation portion, or Shared State Persistence. It is NOT the actual Runtime API so it does not strictly enforce all portions of the student attempt.

QUnit-Tests/js/scorm/SCOBot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* @event exception, load, unload, message, continue, comments_lms, resume
4141
*
4242
* @author Cybercussion Interactive, LLC <info@cybercussion.com>
43-
* @license Copyright (c) 2009-2017, Cybercussion Interactive LLC
43+
* @license Copyright (c) 2009-2020, 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
4646
* @version 4.1.6

QUnit-Tests/js/scorm/SCOBotBase.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
* @event debug, getvalue, setvalue, exception, terminated, StoreData
3636
*
3737
* @author Cybercussion Interactive, LLC <info@cybercussion.com>
38-
* @license Copyright (c) 2009-2017, Cybercussion Interactive LLC
38+
* @license Copyright (c) 2009-2020, 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.6
40+
* @version 4.1.7
4141
* @param options {Object} override default values
4242
* @constructor
4343
*/
@@ -52,9 +52,9 @@ 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.6",
55+
version: "4.1.7",
5656
createDate: "04/05/2011 08:56AM",
57-
modifiedDate: "03/04/2016 12:24AM",
57+
modifiedDate: "05/20/2020 08:18AM",
5858
debug: false,
5959
isActive: false,
6060
throw_alerts: false,
@@ -1422,7 +1422,15 @@ function SCOBotBase(options) {
14221422
return true;
14231423
}
14241424
debug(settings.prefix + ": I was unable to locate an API for communication", 2);
1425+
// Need a gap in time here to allow events to be established, this is happening far before any listeners established.
1426+
setTimeout(function() {
1427+
Utl.triggerEvent(self, 'nolms', { msg: 'Could not locate Runtime API. Your data will not be persisted.'}); // Handle this or not at the SCO level
1428+
}, 1000);
14251429
if (settings.use_standalone) {
1430+
// Hint: You would use standalone mode if you intend on running this different than against a platform.
1431+
// If you were to run this on a platform, and not locate the LMS API due to Same-Origin-Policy or CORS the student would not know
1432+
// there instance was not persisted against the LMS. So this project will now fire up a alert below letting them know no connection
1433+
// was made.
14261434
// Create Local API in SCORM 2004
14271435
debug(settings.prefix + ": If you included Local_API_1484_11 I'll mimic the LMS. If not, all SCORM calls will fail.", 4);
14281436
settings.standalone = true;

QUnit-Tests/js/scorm/SCOBotUtil.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* https://github.com/cybercussion/SCOBot
4343
*
4444
* @author Cybercussion Interactive, LLC <info@cybercussion.com>
45-
* @license Copyright (c) 2009-2016, Cybercussion Interactive LLC
45+
* @license Copyright (c) 2009-2020, Cybercussion Interactive LLC
4646
* As of 3.0.0 this code is under a Creative Commons Attribution-ShareAlike 4.0 International License.
4747
* @version 4.0.5
4848
* @constructor

QUnit-Tests/js/scorm/SCOBot_API_1484_11.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @event StoreData
1818
*
1919
* @author Cybercussion Interactive, LLC <info@cybercussion.com>
20-
* @license Copyright (c) 2009-2017, Cybercussion Interactive LLC
20+
* @license Copyright (c) 2009-2020, 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
2323
* @version 4.1.6

QUnit-Tests/js/test/scobot.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var desiredTimeType = "UTC"; // This gets changed based on tests which can goof
1818
$ = SCOBotUtil,
1919
scorm = new SCOBotBase({
2020
debug: true, // edit
21-
throw_alerts: false, // edit
21+
throw_alerts: true, // edit
2222
time_type: 'UTC', // edit
2323
exit_type: 'suspend', // edit
2424
success_status: 'unknown' // edit
@@ -35,7 +35,11 @@ var desiredTimeType = "UTC"; // This gets changed based on tests which can goof
3535
getvalue_calls = 0,
3636
// These things tend to happen during authoring/creation. We'll use this later to put into suspend data
3737
character_str = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ˜‌‍‎‏–—―‗‘’‚‛“”„†‡•…‰′″‹›‼‾⁄₣₤₧₪₫€℅ℓ№™Ω℮⅓⅔⅛⅜⅝⅞←↑→↓∂√∞∩∫≠≡■□▲△▼○●♀♂♪";
38-
38+
$.addEvent(scorm, "nolms", function (e) {
39+
"use strict";
40+
alert(e.msg);
41+
SB.debug(e.msg, 1);
42+
});
3943
$.addEvent(scorm, "setvalue", function (e) {
4044
"use strict";
4145
setvalue_calls += 1;

0 commit comments

Comments
 (0)