Skip to content

Instantly share code, notes, and snippets.

@schamane
Created April 7, 2011 21:01
Show Gist options
  • Save schamane/908709 to your computer and use it in GitHub Desktop.
Save schamane/908709 to your computer and use it in GitHub Desktop.
start it with : node main.js
var config = {
loadDir: {
base: __dirname + '/',
dirs: [ 'modules/' ]
}
};
require('yui3').YUI( config ).use('loader', 'dump', function(Y) {
Y.log("app starts", 'info');
Y.use('module1', function(Y){
Y.log("callback", 'info');
Y.log( Y.dump(new Y.Module1()), 'info');
});
});
/* this file goes into modules folder at same location as main.js */
YUI.add('module1', function(Y) {
var Module1 = function() {
Y.log("Module created !", 'info', Module1.PACKAGE);
};
Module1.NAME = "Module1";
Module1.PACKAGE = "Module1";
Y.namespace().Module1 = Module1;
Y.log("module load finished", 'info', Module1.PACKAGE);
console.log("inner model1");
}, '0.1', { requires: [ 'oop' ] });
console.log("loading module1 " + new Date());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment