Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle_mod-hvp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle_mod-hvp
Commits
560ed8c5
Commit
560ed8c5
authored
6 years ago
by
Thomas Marstrander
Browse files
Options
Downloads
Patches
Plain Diff
JI-1059 Add queueing failed xAPI results requests
Update library submodule
parent
39eba915
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
library
+1
-1
1 addition, 1 deletion
library
xapi-collector.js
+33
-1
33 additions, 1 deletion
xapi-collector.js
with
34 additions
and
2 deletions
library
@
687f886e
Compare
39d27ab9
...
687f886e
Subproject commit
39d27ab9bb1bb228dc1a69afab3ea50ff65f52e2
Subproject commit
687f886e3d9054b87a9298184f1c2f5ba908d43c
This diff is collapsed.
Click to expand it.
xapi-collector.js
+
33
−
1
View file @
560ed8c5
...
@@ -58,6 +58,28 @@
...
@@ -58,6 +58,28 @@
return
instance
;
return
instance
;
}
}
function
getIframe
(
contentId
)
{
let
iFrames
;
// No content id given.
if
(
!
contentId
)
{
iFrames
=
document
.
getElementsByClassName
(
'
h5p-iframe
'
);
// Assume first iframe.
return
iFrames
[
0
];
}
// Locate iFrames.
iFrames
=
document
.
getElementsByClassName
(
'
h5p-iframe
'
);
for
(
let
i
=
0
;
i
<
iFrames
.
length
;
i
++
)
{
// Search through each iframe for content.
if
(
findInstanceInArray
(
iFrames
[
i
].
contentWindow
.
H5P
.
instances
,
contentId
))
{
return
iFrames
[
i
];
}
}
return
null
;
}
/**
/**
* Get xAPI data for content type and send off.
* Get xAPI data for content type and send off.
*
*
...
@@ -88,7 +110,17 @@
...
@@ -88,7 +110,17 @@
console
.
error
(
'
Storing xAPI results failed with error message:
'
,
data
);
console
.
error
(
'
Storing xAPI results failed with error message:
'
,
data
);
}
}
}).
fail
(
function
()
{
}).
fail
(
function
()
{
H5P
.
offlineRequestQueue
.
add
(
H5PIntegration
.
ajax
.
xAPIResult
,
data
);
// Let H5P iframe know that we want to queue the request for late transmission
const
iframe
=
getIframe
(
contentId
);
if
(
!
iframe
)
{
return
;
}
iframe
.
contentWindow
.
postMessage
(
{
url
:
H5PIntegration
.
ajax
.
xAPIResult
,
data
:
data
,
context
:
'
h5p
'
,
action
:
'
queueRequest
'
,
});
});
});
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment