Show More
@@ -131,11 +131,6 b' define([' | |||||
131 | this.target_name = target_name; |
|
131 | this.target_name = target_name; | |
132 | this.comm_id = comm_id || utils.uuid(); |
|
132 | this.comm_id = comm_id || utils.uuid(); | |
133 | this._msg_callback = this._close_callback = null; |
|
133 | this._msg_callback = this._close_callback = null; | |
134 |
|
||||
135 | var that = this; |
|
|||
136 | this.msg_promise = new Promise(function(resolve, reject) { |
|
|||
137 | that.resolve_msg_promise = resolve; |
|
|||
138 | }); |
|
|||
139 | }; |
|
134 | }; | |
140 |
|
135 | |||
141 | // methods for sending messages |
|
136 | // methods for sending messages | |
@@ -171,7 +166,6 b' define([' | |||||
171 |
|
166 | |||
172 | Comm.prototype.on_msg = function (callback) { |
|
167 | Comm.prototype.on_msg = function (callback) { | |
173 | this._register_callback('msg', callback); |
|
168 | this._register_callback('msg', callback); | |
174 | this.resolve_msg_promise(); |
|
|||
175 | }; |
|
169 | }; | |
176 |
|
170 | |||
177 | Comm.prototype.on_close = function (callback) { |
|
171 | Comm.prototype.on_close = function (callback) { | |
@@ -192,11 +186,7 b' define([' | |||||
192 | }; |
|
186 | }; | |
193 |
|
187 | |||
194 | Comm.prototype.handle_msg = function (msg) { |
|
188 | Comm.prototype.handle_msg = function (msg) { | |
195 | var that = this; |
|
|||
196 | this.msg_promise = this.msg_promise.then(function() { |
|
|||
197 |
|
|
189 | that._maybe_callback('msg', msg); | |
198 | return Promise.resolve(); |
|
|||
199 | }); |
|
|||
200 | }; |
|
190 | }; | |
201 |
|
191 | |||
202 | Comm.prototype.handle_close = function (msg) { |
|
192 | Comm.prototype.handle_close = function (msg) { |
@@ -183,7 +183,7 b' define([' | |||||
183 |
|
183 | |||
184 | WidgetManager.prototype._handle_comm_open = function (comm, msg) { |
|
184 | WidgetManager.prototype._handle_comm_open = function (comm, msg) { | |
185 | // Handle when a comm is opened. |
|
185 | // Handle when a comm is opened. | |
186 | this.create_model({ |
|
186 | return this.create_model({ | |
187 | model_name: msg.content.data.model_name, |
|
187 | model_name: msg.content.data.model_name, | |
188 | model_module: msg.content.data.model_module, |
|
188 | model_module: msg.content.data.model_module, | |
189 | comm: comm}).catch($.proxy(console.error, console)); |
|
189 | comm: comm}).catch($.proxy(console.error, console)); |
General Comments 0
You need to be logged in to leave comments.
Login now