In this example, we bring a YUI component onto the page using the YUI Loader Utility. This example implements YUI Loader via the
YAHOO_config object. We load the YUI Loader script file, then specify in
YAHOO_config which component we want loaded on the page — and what we want to do once it is loaded.
This example loads in new window to demonstrate the simplest use case — a page with no other content, wherein the Loader is introducing YUI into a simple context.
The workflow happens in three steps:
YAHOO_configobject: We use the
YAHOO_configobject to set up our instruction set for Loader, including things like what components to load, whether to load optional components, and what to do once the components are loaded (in this case, once the components are loaded we instantiate a Calendar Control on the page).
YAHOO_configobject and follow any instructions it finds there.
YAHOO_configis consumed by the YUI Loader, and after Loader has brought in the required dependencies, your code that makes use of the requested YUI components can fire. You specify that code (e.g., by pointing to a callback) in
YAHOO_config, but it doesn't get fired until Loader has successfully loaded all of your required components.
This code executes the following steps in order:
YAHOO_configobject. It gets instructions about what components are required, how to configure them, and what code to execute when loading is done.
<link>element on the page.)
onLoadCompletefunction. This is the member of the
YAHOO_config's load object in which we specfied our instantiation logic for Calendar.