foo = function() { this.init.apply(this, arguments); } foo.prototype = (function() { function bar() { ... } function $(id) { }; return { blah: 1 ,init: funciton(stuff) { return $(stuff); } }; })();