Created
January 31, 2015 09:36
-
-
Save khirayama/3d889a9fd4412f4e1909 to your computer and use it in GitHub Desktop.
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 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