Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Working autoloader
got the autoloader working... woot
  • Loading branch information
aikar committed Apr 20, 2011
1 parent 8d966d2 commit 399eca3
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 118 deletions.
7 changes: 5 additions & 2 deletions lib/bootstrap.js
Expand Up @@ -17,6 +17,9 @@ autoloadModules.forEach(function (mod) {
require(mod);
})
// load main Cosmos class
require('./cosmos');

registerAutoloader('Cosmos', __dirname + '/classes', Cosmos);

registerAutoloader('Cosmos', __dirname + '/classes');

var cosmos = new Cosmos;
cosmos.init();
9 changes: 9 additions & 0 deletions lib/classes/Cosmos.js
@@ -0,0 +1,9 @@

Singleton({
methods: {
init: function () {
console.log("COSMOS INIT");
}
}
});

6 changes: 4 additions & 2 deletions lib/classes/Foo.js
@@ -1,5 +1,7 @@
console.log('BARRR');
Class('Cosmos.Foo', {
Class({
constructor: function() {
console.log(arguments);
},
methods: {
bar: function() {
console.log('baz');
Expand Down
4 changes: 0 additions & 4 deletions lib/cosmos.js

This file was deleted.

255 changes: 147 additions & 108 deletions node_modules/autoloader/autoloader.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions test.js
@@ -1,4 +1,3 @@
require('cosmos');
console.log(Cosmos.Foo);
var foo = new Cosmos.Foo();
var foo = new Cosmos.Foo(3,2,1);
foo.bar();

0 comments on commit 399eca3

Please sign in to comment.