Skip to content

Instantly share code, notes, and snippets.

@tzechienchu
Created August 24, 2016 07:34
Show Gist options
  • Save tzechienchu/3f45e7601fb6d9aa817fd428e21c3845 to your computer and use it in GitHub Desktop.
Save tzechienchu/3f45e7601fb6d9aa817fd428e21c3845 to your computer and use it in GitHub Desktop.
Javascript Singleton
var timeZoneService = (function () {
var instance;
function init() {
var prop
var method = function() {
}
return {
prop:prop,
method:method
}
}
return {
getInstance: function () {
if ( !instance ) {
instance = init();
}
return instance;
}
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment