Skip to content

Instantly share code, notes, and snippets.

@mtodd
Created June 15, 2010 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtodd/438745 to your computer and use it in GitHub Desktop.
Save mtodd/438745 to your computer and use it in GitHub Desktop.
var Foo = exports.Foo = function (cb) {
this.foo = 0;
if(!!cb) cb(this);
}
Foo.prototype.toString = function () {
return "[object Foo foo:"+this.foo+"]";
}
exports.Foo = Foo;
function Foo (cb) {
this.foo = 0;
if(!!cb) cb(this);
}
Foo.prototype.toString = function () {
return "[object Foo foo:"+this.foo+"]";
}
var sys = require('sys')
, Foo = require('./foo').Foo;
sys.puts(new Foo());
sys.puts(new Foo(function (e) {
e.foo = 1;
sys.puts(e);
e.foo = 2;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment