Skip to content

Instantly share code, notes, and snippets.

@rgrove
Created April 29, 2010 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgrove/383871 to your computer and use it in GitHub Desktop.
Save rgrove/383871 to your computer and use it in GitHub Desktop.
Lazy loading with Y.use()
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