async/await
and optional chaining. These features are supported by all cutting-edge modern browsers as of December 2020. Use a transpiler if you have to support older browsers.loadContentCallback
. The components won't work without the callback.loadContentCallback
is set or changedcontentId
is setcontentId
and it will discard the old content and display the new one. You can also safely remove the component from the DOM.contentId
to the string new
. Caution: If the newly created content is saved later, then its contentId
will be undefined
in saveContententCallback
, not new
!save()
method (you must get a reference to component by using React.createRef
):saveContentCallback
(see below) with all the data needed to save the content.loadContentCallback
to a function that retrieves the necessary data from the backend. It returns a promise of data that follows the structure of IPlayerModel in types.ts in @lumieducation/h5p-server. If there is an error, the callback should throw an error object with the error message in the message
property.H5PPlayer.render(...)
:contentId
can be undefined
if the editor is used to create new contentcontentId
is defined.H5PEditor.saveOrUpdateContentReturnMetaData(...)
and then return the result to the client, which returns the result as the return value of saveContentCallback
.contentId
can be undefined
, if the user is creating new content.on...
methods in the props of the components.contentId
in the parameters. Note: The event is emitted by H5P at a point when all the scripts, but possibly not all resources (images etc.) might be loaded. You should only use the event as an indication of initialization state.contentId
and an ubername of the main content type in the paramters.contentId
and content metadata can be found in the paramters.save()
method instead of subscribing to this event.message
paramter.save()
method in a try {...} catch {...}
block instead of subscribing to this event.initialized
event was fired. Important: This object is only partially typed and there are more properties and methods on it!initialized
event was fired. Important: This object is only partially typed and there are more properties and methods on it!