Created
July 4, 2012 02:48
-
-
Save zerokarmaleft/3044959 to your computer and use it in GitHub Desktop.
defining node.js modules
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
(function() { | |
var Foo; | |
Foo = (function() { | |
function Foo() { | |
// initialize properties | |
} | |
// instance methods | |
Foo.prototype.bar = function() {}; | |
Foo.prototype.baz = function() {}; | |
return Foo; | |
})(); | |
exports.Foo = function() { | |
return new Foo(); | |
}; | |
}).call(this); |
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
var foo = require('foo'); | |
var foo_instance = foo.Foo(); | |
foo_instance.bar(); | |
foo_instance.baz(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment