Skip to content

Instantly share code, notes, and snippets.

@khirayama
Created January 31, 2015 09:36
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 khirayama/3d889a9fd4412f4e1909 to your computer and use it in GitHub Desktop.
Save khirayama/3d889a9fd4412f4e1909 to your computer and use it in GitHub Desktop.
var Model = (function() {
var _fromGetInstance = false;
var _instance;
function _construct() {
if (_fromGetInstance !== true) {
throw new Error("must use the getInstance.");
}
_fromGetInstance = false;
}
_construct.getInstance = function() {
if (_instance) {
return _instance;
}
_fromGetInstance = true;
return _instance = new this();
}
return _construct;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment