JI-1352 Add event when h5p has finished initializing

This is useful if you want to hook into H5P functionality after the
init function has run, e.g. 'resize' event in instances
pull/68/head 1.24
Thomas Marstrander 2019-10-10 10:34:57 +02:00
parent 159f83f1b8
commit 9a658ba387
No known key found for this signature in database
GPG Key ID: 59D7F1EC8B90E9A6
1 changed files with 4 additions and 0 deletions

View File

@ -369,6 +369,10 @@ H5P.init = function (target) {
$element.on('mousedown keydown keyup', function (event) { $element.on('mousedown keydown keyup', function (event) {
$element.toggleClass('using-mouse', event.type === 'mousedown'); $element.toggleClass('using-mouse', event.type === 'mousedown');
}); });
if (H5P.externalDispatcher) {
H5P.externalDispatcher.trigger('initialized');
}
}); });
// Insert H5Ps that should be in iframes. // Insert H5Ps that should be in iframes.