Change return type from sending messages

Pass the whole result from the outgoing message callback on to the
caller, and preserve the names of the members.

// FREEBIE
This commit is contained in:
lilia 2015-11-19 16:50:14 -08:00
parent 7b6820d2ac
commit 5c37c3d6ce
4 changed files with 15 additions and 15 deletions

View file

@ -58,10 +58,10 @@ MessageSender.prototype = {
sendIndividualProto: function(number, proto, timestamp) {
return new Promise(function(resolve, reject) {
this.sendMessageProto(timestamp, [number], proto, function(res) {
if (res.failure.length > 0)
reject(res.failure);
if (res.errors.length > 0)
reject(res);
else
resolve();
resolve(res);
});
}.bind(this));
},
@ -125,10 +125,10 @@ MessageSender.prototype = {
return new Promise(function(resolve, reject) {
this.sendMessageProto(timestamp, numbers, proto, function(res) {
if (res.failure.length > 0)
reject(res.failure);
if (res.errors.length > 0)
reject(res);
else
resolve();
resolve(res);
});
}.bind(this)).then(this.sendSyncMessage.bind(this, proto, timestamp));
},