Skip to content

Instantly share code, notes, and snippets.

@alanshaw
Created November 16, 2012 13:01
Show Gist options
  • Save alanshaw/4087172 to your computer and use it in GitHub Desktop.
Save alanshaw/4087172 to your computer and use it in GitHub Desktop.
Compiled CoffeeScript from https://gist.github.com/4085837
var Foo, singletonFoo;
Foo = (function() {
var _this = this;
function Foo() {}
Foo.instance = (function() {
var instance;
instance = null;
return function() {
if (!instance) {
instance = new Foo();
}
return instance;
};
})();
return Foo;
}).call(this);
singletonFoo = Foo.instance();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment