Core
Welcome to H5P's Core JavaScript API Reference Documentation.
Use the navigation to browse the H5P namespaces and classes.
Documentation
For tutorials and guides, please visit the documentation section.
Source
If you wish to make a contribution, or if you're simply curious of the source code it can be found on https://github.com/h5p/h5p-php-library.
H5P Command Line Interface
Available via npm
npm install -g h5p
Example library
mylib.js
:
H5P.MyLib = (function ($) {
/**
* @class H5P.MyLib
* @param {Object} params
*/
function MyLib(params) {
var $wrapper;
this.attach = function ($container) {
if ($wrapper === undefined) {
$wrapper = $('<div/>', {
html: 'Hello ' + params.name
});
}
$container.html('').addClass('h5p-mylib').append($wrapper);
};
}
return MyLib;
})(H5P.jQuery);
semantics.json
:
[
{
"name": "name",
"type": "text",
"label": "What is your name?"
}
]
library.json
:
{
"title": "My Lib",
"machineName": "MyLib",
"majorVersion": 1,
"minorVersion": 0,
"patchVersion": 0,
"runnable": 1,
"preloadedJs": [
{"path": "mylib.js"}
]
}
License
(The MIT License)
Copyright (c) 2012-2015 Joubel AS
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.