@@ -263,6 +263,7 @@ Cmi5.prototype = {
263
263
@param {Function } [events.learnerPrefs] Function to run after retrieving learner preferences
264
264
@param {Function } [events.initializeStatement] Function to run after saving initialization statement
265
265
@param {Object } [additionalProperties] Optional object param with properties to customize method behavior.
266
+ @return {Promise }
266
267
*/
267
268
start : async function ( events = { } , additionalProperties ) {
268
269
this . log ( "start" ) ;
@@ -303,6 +304,7 @@ Cmi5.prototype = {
303
304
`setFetch` has to be called first and is called by the constructor if the launch string was provided to it.
304
305
305
306
@method postFetch
307
+ @return {Promise }
306
308
*/
307
309
postFetch : async function ( ) {
308
310
this . log ( "postFetch" ) ;
@@ -352,6 +354,7 @@ Cmi5.prototype = {
352
354
Fetch data has to have already been loaded, in order to have LRS credential.
353
355
354
356
@method loadLMSLaunchData
357
+ @return {Promise }
355
358
*/
356
359
loadLMSLaunchData : async function ( ) {
357
360
this . log ( "loadLMSLaunchData" ) ;
@@ -399,6 +402,7 @@ Cmi5.prototype = {
399
402
Method to load learner prefs agent profile document possibly populated by the LMS
400
403
401
404
@method loadLearnerPrefs
405
+ @return {Promise }
402
406
*/
403
407
loadLearnerPrefs : async function ( ) {
404
408
this . log ( "loadLearnerPrefs" ) ;
@@ -456,6 +460,7 @@ Cmi5.prototype = {
456
460
Method to save learner prefs to agent profile document in LRS
457
461
458
462
@method saveLearnerPrefs
463
+ @return {Promise }
459
464
*/
460
465
saveLearnerPrefs : async function ( ) {
461
466
this . log ( "saveLearnerPrefs" ) ;
@@ -511,6 +516,7 @@ Cmi5.prototype = {
511
516
@method initialize
512
517
@param {Object } [additionalProperties] Optional object containing properties to append to the cmi5 statement.
513
518
@throws {Error } <ul><li>Learner prefs not loaded</li><li>AU already initialized</li></ul>
519
+ @return {Promise<statement> } A promise that contains the statement object that was stored
514
520
*/
515
521
initialize : async function ( additionalProperties = { } ) {
516
522
this . log ( "initialize" ) ;
@@ -540,6 +546,8 @@ Cmi5.prototype = {
540
546
this . _initialized = true ;
541
547
this . _isActive = true ;
542
548
this . _durationStart = new Date ( ) . getTime ( ) ;
549
+
550
+ return st ;
543
551
} ,
544
552
545
553
/**
@@ -548,6 +556,7 @@ Cmi5.prototype = {
548
556
@method terminate
549
557
@param {Object } [additionalProperties] Optional object containing properties to append to the cmi5 statement.
550
558
@throws {Error } <ul><li>AU not initialized</li><li>AU already terminated</li></ul>
559
+ @return {Promise<statement> } A promise that contains the statement object that was stored
551
560
*/
552
561
terminate : async function ( additionalProperties = { } ) {
553
562
this . log ( "terminate" ) ;
@@ -572,6 +581,8 @@ Cmi5.prototype = {
572
581
573
582
this . _terminated = true ;
574
583
this . _isActive = false ;
584
+
585
+ return st ;
575
586
} ,
576
587
577
588
/**
@@ -580,6 +591,7 @@ Cmi5.prototype = {
580
591
@method completed
581
592
@param {Object } [additionalProperties] Optional object containing properties to append to the cmi5 statement.
582
593
@throws {Error } <ul><li>AU not active</li><li>AU not in normal launch mode</li><li>AU already completed</li></ul>
594
+ @return {Promise<statement> } A promise that contains the statement object that was stored
583
595
*/
584
596
completed : async function ( additionalProperties = { } ) {
585
597
this . log ( "completed" ) ;
@@ -607,6 +619,8 @@ Cmi5.prototype = {
607
619
608
620
this . setProgress ( null ) ;
609
621
this . _completed = true ;
622
+
623
+ return st ;
610
624
} ,
611
625
612
626
/**
@@ -615,6 +629,7 @@ Cmi5.prototype = {
615
629
@method passed
616
630
@param {Object } [score] Score to be included in statement (see `passedStatement`)
617
631
@throws {Error } <ul><li>AU not active,</li><li>AU not in Normal launch mode,</li><li>AU already passed,</li><li>Failed to create passed statement (usually because of malformed score)</li></ul>
632
+ @return {Promise<statement> } A promise that contains the statement object that was stored
618
633
*/
619
634
passed : async function ( score ) {
620
635
this . log ( "passed" ) ;
@@ -646,6 +661,8 @@ Cmi5.prototype = {
646
661
}
647
662
648
663
this . _passed = true ;
664
+
665
+ return st ;
649
666
} ,
650
667
651
668
/**
@@ -654,6 +671,7 @@ Cmi5.prototype = {
654
671
@method failed
655
672
@param {Object } [score] Score to be included in statement (see `failedStatement`)
656
673
@throws {Error } <ul><li>AU not active</li><li>AU not in Normal launch mode</li><li>AU already passed/failed</li><li>Failed to create failed statement (usually because of malformed score)</li></ul>
674
+ @return {Promise<statement> } A promise that contains the statement object that was stored
657
675
*/
658
676
failed : async function ( score ) {
659
677
this . log ( "failed" ) ;
@@ -685,6 +703,8 @@ Cmi5.prototype = {
685
703
}
686
704
687
705
this . _failed = true ;
706
+
707
+ return st ;
688
708
} ,
689
709
690
710
/**
@@ -1308,6 +1328,7 @@ Cmi5.prototype = {
1308
1328
1309
1329
@method sendStatement
1310
1330
@param {Object } st Statement to be stored
1331
+ @return {Promise }
1311
1332
*/
1312
1333
sendStatement : async function ( st ) {
1313
1334
this . log ( "sendStatement" , st ) ;
@@ -1351,6 +1372,7 @@ Cmi5.prototype = {
1351
1372
1352
1373
@method sendStatements
1353
1374
@param {Array } sts Statements to be stored
1375
+ @return {Promise }
1354
1376
*/
1355
1377
sendStatements : async function ( sts ) {
1356
1378
this . log ( "sendStatements" , sts ) ;
0 commit comments