In this example, we bring a YUI component onto the page using the YUI Loader Utility. This example implements YAHOO.util.YUILoader.
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.
This example implements the YUI Loader Utility to load the Calendar Control.
The workflow happens in three steps:
YAHOO.util.YUILoader
instance: We pass a configuration object 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).Here's what that looks like in terms of raw source — this is the full JavaScript source code for this example:
This code executes the following steps in order:
<script>
node that it inserts on the page. It waits for that file to load, then loads the Calendar Control's JavaScript file; this must be loaded after Yahoo, Dom and Event are in place. (The CSS file is loaded immediately by inserting a <link>
element on the page.) onSuccess
function. This is the member of the configuration object in which we specfied our instantiation logic for Calendar. Copyright © 2007 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Copyright Policy - Job Openings