Created
June 21, 2013 00:11
-
-
Save op1ekun/5827911 to your computer and use it in GitHub Desktop.
commonJS approach used to create a custom YUI module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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