Adding ability to deregister event listeners
This commit is contained in:
20
README.md
20
README.md
@@ -177,6 +177,16 @@ window.API.on("LMSSetValue.cmi.*", function(CMIElement, value) {
|
||||
});
|
||||
```
|
||||
|
||||
You also have to ability to remove specific callback listeners:
|
||||
```javascript
|
||||
window.API.off("LMSInitialize", callback);
|
||||
```
|
||||
|
||||
Or, you can clear all callbacks for a particular event:
|
||||
```javascript
|
||||
window.API.clear("LMSInitialize");
|
||||
```
|
||||
|
||||
### SCORM 2004 Listeners
|
||||
|
||||
For convenience, hooks are available for all the SCORM API Signature functions:
|
||||
@@ -220,6 +230,16 @@ window.API_1484_11.on("SetValue.cmi.* ", function(CMIElement, value) {
|
||||
});
|
||||
```
|
||||
|
||||
You also have to ability to remove specific callback listeners:
|
||||
```javascript
|
||||
window.API_1484_11.off("Initialize", callback);
|
||||
```
|
||||
|
||||
Or, you can clear all callbacks for a particular event:
|
||||
```javascript
|
||||
window.API_1484_11.clear("Initialize");
|
||||
```
|
||||
|
||||
### Total Time Calculation
|
||||
The APIs provide a convenience method `getCurrentTotalTime()` that can be used for calculating the current `total_time` value, based on the current `session_time` and the `total_time` supplied when the module was launched. This works for both ISO 8601 duration time formats in SCORM 2004 as well as the HH:MM:SS format in SCORM 1.2 and AICC, and outputs the correct format based on the version used.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user