Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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