From c9cb04d420ab85341578fadaeb4b67f33edcc7f9 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Fri, 8 Jan 2016 15:22:47 -0800 Subject: [PATCH] Make Shutdown() do something. --- static/hogfather.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/static/hogfather.js b/static/hogfather.js index bc3fe4a..f587304 100644 --- a/static/hogfather.js +++ b/static/hogfather.js @@ -50,7 +50,8 @@ hogfather.PublicChat = function(cosmo, id) { this.dispatchEvent = this.eventTarget_.dispatchEvent.bind(this.eventTarget_); - this.cosmo_.addEventListener('message', this.onMessage_.bind(this)); + this.boundOnMessage_ = this.onMessage_.bind(this); + this.cosmo_.addEventListener('message', this.boundOnMessage_); }; @@ -98,8 +99,12 @@ hogfather.PublicChat.prototype.Start_ = function() { /** + * @return {Promise} */ hogfather.PublicChat.prototype.Shutdown = function() { + console.log(this.loggingPrefix_(), 'shutdown start'); + this.cosmo_.removeEventListener('message', this.boundOnMessage_); + return this.cosmo_.unsubscribe(this.subject_); };