Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger set user data more often to ensure state transmission #107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions js/h5p.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ H5P.init = function (target) {
// xAPI events will schedule a save in three seconds.
H5P.on(instance, 'xAPI', function (event) {
var verb = event.getVerb();
if (verb === 'completed' || verb === 'progressed') {
if (verb === 'completed' || verb === 'progressed' || verb === 'answered') {
clearTimeout(saveTimer);
saveTimer = setTimeout(save, 3000);
}
Expand Down Expand Up @@ -2865,11 +2865,11 @@ H5P.createTitle = function (rawTitle, maxLength) {
// iPad does not support beforeunload, therefore using unload
H5P.$window.one('beforeunload unload', function () {
// Only want to do this once
H5P.$window.off('pagehide beforeunload unload');
H5P.$window.off('pagehide visibilitychange beforeunload unload');
storeCurrentState();
});
// pagehide is used on iPad when tabs are switched
H5P.$window.on('pagehide', storeCurrentState);
H5P.$window.on('pagehide visibilitychange', storeCurrentState);
}
});

Expand Down