Created
April 29, 2010 16:50
-
-
Save rgrove/383871 to your computer and use it in GitHub Desktop.
Lazy loading with Y.use()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI().use('foo', function (Y) { | |
// ... do stuff with foo ... | |
// When you need to load "bar", call Y.use() and use it inside the | |
// callback. The difference between YUI().use() and Y.use() is that | |
// the first creates a new YUI instance, whereas the second adds | |
// "bar" to the existing instance. | |
Y.use('bar', function () { | |
// ... do stuff with bar ... | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment