API.html Class
API for Wanaplan html helpers.
Constructor
API.html
()
Item Index
Methods
Methods
addCSS
(
-
url
-
success
-
fail
Adds a CSS stylesheet to the document.
addHTML
(
-
url
-
domElement
-
success
-
fail
Loads and adds an HTMLElement
to the document.
Parameters:
-
url
StringThe url of the HTML element to load.
-
domElement
HTMLElementAn instance of a DOM element.
-
success
FunctionA function called if the operation is completed successfully.
-
fail
FunctionA function called if the operation fails.
addScript
(
-
url
-
success
-
fail
Loads a script in the document.
addScripts
(
-
scripts
-
[options]
-
[successCallback]
-
[errorCallback]
-
[interval]
Loads a collection of scripts. Here are two methods to load scripts.
- A simple array of urls [ "script.js", "script2.js" ]
- An array of dictionaries [ { MyObject: "myObjectScript.js" } ]. In this case the function will test if the script is already loaded by using the key of the dictionary as object name.
Parameters:
-
scripts
ArrayAn array of urls or an array of dictionaries as described above
-
[options]
Object optionalA dictionary of parameters (ex. { "async": "true" }).
-
[successCallback]
Function optionalA function to call when the script is loaded successfully.
-
[errorCallback]
Function optionalA function to call if the process fails.
-
[interval]
Number optionalTime to wait when checking all is loaded in the end.