Compare commits

...

1 Commits

Author SHA1 Message Date
Pål Jørgensen 066052a2a1 Forwarding xAPI events to parent window on embed 2016-11-25 19:27:55 +01:00
1 changed files with 7 additions and 0 deletions

View File

@ -335,6 +335,13 @@ H5P.init = function (target) {
H5P.trigger(instance, 'resize'); H5P.trigger(instance, 'resize');
}); });
// Forward xAPI events to parent window, making it possible to use the
// following code from parent window to get events:
// window.addEventListener('message', function (event) { <...> });
H5P.externalDispatcher.on('xAPI', function (event) {
H5P.communicator.send('xAPI', event.data);
});
H5P.on(instance, 'resize', function () { H5P.on(instance, 'resize', function () {
if (H5P.isFullscreen) { if (H5P.isFullscreen) {
return; // Skip iframe resize return; // Skip iframe resize