Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Created August 27, 2013 14:31
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 GavinJoyce/6354301 to your computer and use it in GitHub Desktop.
Save GavinJoyce/6354301 to your computer and use it in GitHub Desktop.
Ember Singleton
App.Singleton = Em.Mixin.create({
instance: function() {
if(!this._instance) {
this._instance = this.createInstance();
}
return this._instance;
},
//override this in your class
createInstance: function() {
return this.create({});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment