I'm jumping into a project authored by another developer, and am trying to make my way around the codebase.
Here's the code I'm having trouble with:
var ret;
ret = new $.Deferred();
new Parse.Query(Model).include('companyDetails').matchesQuery('companyDetails',
new Parse.Query(UserModel).equalTo('objectId', 'seppWfGi20')).first().done((function(_this) {
return function(person) {
if (person) {
_this.data.person = person;
return ret.resolve(_this.data.person);
} else {
return ret.reject('person');
}
};
})(this)).fail((function(_this) {
return function(error) {
return ret.reject('person');
};
})(this));
ret;
I can't work out what the .done()
and .fail()
methods are doing. Also, what's the .first()
there for?
Can any jQuery ninjas help explain what this code is doing, step-by-step?
Any help is appreciated. Thanks in advance!