Wrap message receiver for minimum api exposure

Initializing a message receiver opens the socket and starts listening
right away rather than requiring a separate call to connect. The only
other publicly accessible method is to query the socket status.

// FREEBIE
This commit is contained in:
lilia 2015-06-17 11:30:29 -07:00
parent 18433419c9
commit b0603bc91a
3 changed files with 24 additions and 7 deletions

View file

@ -39469,6 +39469,7 @@ function generateKeys(count, progressCallback) {
} else {
throw new TypeError('MessageReceiver expected an EventTarget');
}
this.connect();
}
MessageReceiver.prototype = {
@ -39624,8 +39625,16 @@ function generateKeys(count, progressCallback) {
}
};
textsecure.MessageReceiver = MessageReceiver;
textsecure.MessageReceiver = function (eventTarget) {
var messageReceiver = new MessageReceiver(eventTarget);
this.getStatus = function() {
return messageReceiver.getStatus();
}
}
textsecure.MessageReceiver.prototype = {
constructor: textsecure.MessageReceiver
};
}());