Skip to content

Instantly share code, notes, and snippets.

@chrisjlee
Last active August 29, 2015 13:58
Show Gist options
  • Save chrisjlee/10399857 to your computer and use it in GitHub Desktop.
Save chrisjlee/10399857 to your computer and use it in GitHub Desktop.
Using the YUI namespace function to create a javascript module

The design of this has some issues. It requires calling YUI use for each public / private method. Nonethless, this is how you setup a javascript module using module pattern and YUI namepsace.

YUInstance = YUI();
YUInstance.namespace('MYNAMESPACE.module');
MYNAMESPACE.module = (function () {
function private() {
// Do magic
}
return {
init: function () {
private();
}
}
})(YUInstance);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment