Skip to content

Instantly share code, notes, and snippets.

@lukemelia
Created August 13, 2012 20:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lukemelia/1b54f0956ba10195a3bc to your computer and use it in GitHub Desktop.
Save lukemelia/1b54f0956ba10195a3bc to your computer and use it in GitHub Desktop.
Editor.ModelPromise = {
init: function() {
this._super();
this._deferred = $.Deferred();
this._deferred.promise(this);
this.one('didLoad', this, '_resolveModelPromise');
this.one('becameError', this, '_rejectModelPromise');
},
_resolveModelPromise: function() {
console.log("Resolving model promise of " + this.toString());
this._deferred.resolve(this);
},
_rejectModelPromise: function() {
this._deferred.reject(this);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment