Skip to content

Instantly share code, notes, and snippets.

@jamischarles
Created February 8, 2011 13:36
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 jamischarles/816447 to your computer and use it in GitHub Desktop.
Save jamischarles/816447 to your computer and use it in GitHub Desktop.
This is a great way to define modules for the YUI loader and ensuring the dependencies get pulled in
YUI.add('breeze-nav', function(Y) {
Y.namespace('bb.session.Nav');
bb.session.Nav = function() {
// expose an API
// this in here will execute when it's pulled in through YUI().use()
};
}, '0.1.1' /* module version */, {
requires: ['node', 'io'] //pull in node, io modules before executing
})
// now you can pull it in from another file
YUI().use('breeze-nav', function(Y){
//run your code here...
//everything in breeze nav will have loaded, and the dependencies
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment