Skip to content

Commit 20bbdb9

Browse files
committed
Merge pull request #180 from leeyeh/deprecate-existed
[chore] Deprecate AV.Object.prototype.existed().
2 parents a0909ff + 9d5e537 commit 20bbdb9

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

lib/object.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ module.exports = function(AV) {
112112
// Attach all inheritable methods to the AV.Object prototype.
113113
_.extend(AV.Object.prototype, AV.Events,
114114
/** @lends AV.Object.prototype */ {
115-
_existed: false,
116115
_fetchWhenSave: false,
117116

118117
/**
@@ -789,8 +788,8 @@ module.exports = function(AV) {
789788
var self = this;
790789
var request = AV._request("classes", this.className, this.id, 'GET',
791790
fetchOptions);
792-
return request.then(function(response, status, xhr) {
793-
self._finishFetch(self.parse(response, status, xhr), true);
791+
return request.then(function(response) {
792+
self._finishFetch(self.parse(response), true);
794793
return self;
795794
})._thenRunCallbacks(options, this);
796795
},
@@ -927,8 +926,8 @@ module.exports = function(AV) {
927926
var makeRequest = options._makeRequest || AV._request;
928927
var request = makeRequest(route, className, model.id, method, json);
929928

930-
request = request.then(function(resp, status, xhr) {
931-
var serverAttrs = model.parse(resp, status, xhr);
929+
request = request.then(function(resp) {
930+
var serverAttrs = model.parse(resp);
932931
if (options.wait) {
933932
serverAttrs = _.extend(attrs || {}, serverAttrs);
934933
}
@@ -988,7 +987,7 @@ module.exports = function(AV) {
988987
* Converts a response into the hash of attributes to be set on the model.
989988
* @ignore
990989
*/
991-
parse: function(resp, status, xhr) {
990+
parse: function(resp) {
992991
var output = _.clone(resp);
993992
_(["createdAt", "updatedAt"]).each(function(key) {
994993
if (output[key]) {
@@ -998,9 +997,6 @@ module.exports = function(AV) {
998997
if (!output.updatedAt) {
999998
output.updatedAt = output.createdAt;
1000999
}
1001-
if (status) {
1002-
this._existed = (status !== 201);
1003-
}
10041000
return output;
10051001
},
10061002

@@ -1067,12 +1063,13 @@ module.exports = function(AV) {
10671063
},
10681064

10691065
/**
1070-
* Returns true if this object was created by the AV server when the
1066+
* (DEPRECATED) Returns true if this object was created by the AV server when the
10711067
* object might have already been there (e.g. in the case of a Facebook
10721068
* login)
10731069
*/
10741070
existed: function() {
1075-
return this._existed;
1071+
console.warn('AV.Object.prototype.existed() is deprecated.');
1072+
return false;
10761073
},
10771074

10781075
/**
@@ -1494,12 +1491,12 @@ module.exports = function(AV) {
14941491
};
14951492
})
14961493

1497-
}).then(function(response, status, xhr) {
1494+
}).then(function(response) {
14981495
var error;
14991496
AV._arrayEach(batch, function(object, i) {
15001497
if (response[i].success) {
15011498
object._finishSave(
1502-
object.parse(response[i].success, status, xhr));
1499+
object.parse(response[i].success));
15031500
} else {
15041501
error = error || response[i].error;
15051502
object._cancelSave();

0 commit comments

Comments
 (0)