Graphics Reference
In-Depth Information
This statement loads the script.js file, adds it to the DOM of the current
page, and then executes it. Since this operation runs asynchronously rather than
directly (in other words, it only completes after a certain time delay), you cannot
access the contents of the script in the line immediately after the statement.
Therefore, the following extended yepnope function is often used, in which
a function is passed as a so-called callback. This callback function is executed
internally by yepnope.js as soon as the requested file is completely loaded. This
ensures that the content is not accessed too early, avoiding a potential error.
yepnope({
load: "http://URL/script.js"
callback: function() {
// File fully loaded
}
});
Moreover, yepnope.js is able to load multiple files with a single command.
To do this, you can use the both parameter and pass an array with the files
you want to load. The callback function will be executed only when all of the
requested files have been loaded.
yepnope({
both: [
"http://URL/script.js",
"http://URL/styles.css"
],
callback: function() {
// File fully loaded
}
});
More specific examples of how to use yepnope.js in Edge Animate are pre-
sented in sections 7.1.4 and 7.4.
 
Search WWH ::




Custom Search