Skip to content

Instantly share code, notes, and snippets.

@op1ekun
Created June 21, 2013 00:11
Show Gist options
  • Save op1ekun/5827911 to your computer and use it in GitHub Desktop.
Save op1ekun/5827911 to your computer and use it in GitHub Desktop.
commonJS approach used to create a custom YUI module
// cheat jQuery that so it uses module exports instead of global variable
// FIXME needs feature detection before defining module
var module = {
exports : {}
}
// version with global module export
YUI.add('dlp-jquery-commonjs', function(Y) {
Y.Get.script('http://code.jquery.com/jquery-1.10.1.min.js', {
onSuccess : function() {
console.log('onSuccess args', arguments);
Y.namespace('dlp')
.jQuery = module.exports;
}
});
}, '1.10.1', {
requires : [ 'get' ]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment