You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: rename useBeaconInsteadOfFetch to asyncModeBeaconBehavior (#1326)
* refactor: rename useBeaconInsteadOfFetch to asyncModeBeaconBehavior
- Renamed setting to clarify it only applies to async commit mode
- In sync mode (default), termination always uses sendBeacon (hardcoded)
- Added backwards compatibility with deprecation warning for old setting
- Updated MIGRATION.md with:
- Fixed sendBeacon documentation (section 23)
- Added mastery_override default change (section 7)
- Added API method parameters change (section 13)
- Updated all settings references
- Renumbered sections appropriately
- Added new settings to tables
* chore: remove unused useBeaconInsteadOfFetch backwards compatibility
Setting was never released, so no backwards compatibility needed.
* fix: allow boolean in ResultObject.result for backwards compatibility
The result field now accepts string | boolean to maintain compatibility
with custom response handlers that may return boolean values.
* test: Update tests for asyncModeBeaconBehavior rename and add boolean result tests
- Rename useBeaconInsteadOfFetch to asyncModeBeaconBehavior in test file
- Add test case for boolean false in _isSuccessResponse
- Add tests for boolean true/false results from LMS triggering correct events
* fix: convert boolean ResultObject.result to string for internal use
When LMS returns boolean true/false in result, convert to string "true"/"false"
for internal API return values while maintaining backwards compatibility.
---------
Co-authored-by: Claude <[email protected]>
// v2.6.5: false (LMS does NOT override lesson_status based on score)
176
+
// v3.0.0: true (LMS WILL override lesson_status based on mastery score - per SCORM 1.2 spec)
177
+
```
178
+
179
+
This means if a learner's score meets or exceeds the mastery score, `lesson_status` will automatically be set to `passed` (or `failed` if below). To preserve v2.6.5 behavior:
Per SCORM specification, `LMSInitialize()`, `LMSFinish()`, and `LMSCommit()` now accept an optional parameter that **must be an empty string** if provided:
270
+
271
+
```javascript
272
+
// v2.6.5 - No parameter
273
+
api.LMSInitialize();
274
+
api.LMSFinish();
275
+
api.LMSCommit();
276
+
277
+
// v3.0.0 - Parameter optional, but must be empty string if provided
**Note:** If you don't configure sequencing, behavior is unchanged from v2.6.5.
352
394
353
-
### 20. Offline Storage Support
395
+
### 22. Offline Storage Support
354
396
355
397
New settings for offline operation:
356
398
-`enableOfflineSupport` - Enable offline data storage
357
399
-`syncOnInitialize` - Sync when API initializes
358
400
-`syncOnTerminate` - Sync when API terminates
359
401
-`maxSyncAttempts` - Maximum retry attempts
360
402
361
-
### 21. sendBeacon for Termination
403
+
### 23. sendBeacon for Termination
404
+
405
+
**In synchronous mode (default):** Termination commits automatically use `navigator.sendBeacon()` for reliable delivery during page unload. This is hardcoded behavior and cannot be disabled.
362
406
363
-
Termination commits now use `navigator.sendBeacon()` by default for reliable delivery during page unload.
407
+
**In asynchronous mode:** The `asyncModeBeaconBehavior` setting controls when sendBeacon is used:
408
+
-`"never"` (default) - Always use fetch API
409
+
-`"on-terminate"` - Use sendBeacon for termination commits only
410
+
-`"always"` - Use sendBeacon for all commits
364
411
365
-
### 22. New Settings
412
+
### 24. New Settings
366
413
367
414
| Setting | Type | Default | Description |
368
415
|---------|------|---------|-------------|
369
416
|`useAsynchronousCommits`|`boolean`|`false`| Use async HTTP (NOT SCORM-compliant) |
0 commit comments