Skip to content

Instantly share code, notes, and snippets.

@lsmith
Created August 25, 2009 06:46
Show Gist options
  • Save lsmith/174514 to your computer and use it in GitHub Desktop.
Save lsmith/174514 to your computer and use it in GitHub Desktop.
YUI.add("myapp-base", function(Y){
Y.MyApplication = function () {};
// Class definition
Y.MyApplication.prototype = {
//...
};
}, "3.0.0b1", {requires:["node"]});
// Submodule definition
YUI.add("myapp-submodule", function(Y){
//...
}, "3.0.0b1", {requires:["myapp-base"]});
// Rollup definition
YUI.add("myapp", function(Y){}, "3.0.0b1", {use: ["myapp-base", "myapp-submodule"]});
<script src="/my/local/yui3/build/yui/yui.js"></script>
<script src="custom_module.js"></script>
<script>
// This does not work
YUI({
base: '/my/local/yui3/build/',
modules:{
myapp:{
requires:["node"] // should be unnecessary, but fails even without this
}
}
}).use("myapp", function(Y) {
// Node is NOT loaded
debugger;
});
<script src="/my/local/yui3/build/yui/yui.js"></script>
<!--script src="custom_module.js"></script-->
<script>
// This works
YUI({
base: '/my/local/yui3/build/',
modules:{
myapp:{
fullpath: 'custom_module.js',
requires:["node"]
}
}
}).use("myapp", function(Y) {
// Node is loaded
debugger;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment