Delay hogfather promise resolution until subscription syncs up.
This commit is contained in:
@@ -30,9 +30,7 @@ var hogfather = {};
|
|||||||
hogfather.PublicChat = function(cosmo, id) {
|
hogfather.PublicChat = function(cosmo, id) {
|
||||||
this.cosmo_ = cosmo;
|
this.cosmo_ = cosmo;
|
||||||
this.id_ = id;
|
this.id_ = id;
|
||||||
this.group_ = '/hogfather/public/' + id;
|
this.subject_ = '/hogfather/public/' + id;
|
||||||
|
|
||||||
console.log(this.loggingPrefix_(), 'construct');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -68,9 +66,13 @@ hogfather.PublicChat.Join = function(cosmo, id) {
|
|||||||
*/
|
*/
|
||||||
hogfather.PublicChat.prototype.Start = function() {
|
hogfather.PublicChat.prototype.Start = function() {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
// XXX
|
this.cosmo_.subscribe(this.subject_, -1).then(function() {
|
||||||
resolve();
|
console.log(this.loggingPrefix_(), 'ready');
|
||||||
});
|
resolve();
|
||||||
|
}.bind(this)).catch(function(err) {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
}.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user