From 9a658ba387c7cc2d580bbf0800bc814a04537fca Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 10 Oct 2019 10:34:57 +0200 Subject: [PATCH] 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 --- js/h5p.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/h5p.js b/js/h5p.js index 4e44806..5d2a8f6 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -369,6 +369,10 @@ H5P.init = function (target) { $element.on('mousedown keydown keyup', function (event) { $element.toggleClass('using-mouse', event.type === 'mousedown'); }); + + if (H5P.externalDispatcher) { + H5P.externalDispatcher.trigger('initialized'); + } }); // Insert H5Ps that should be in iframes.