Show More
@@ -51,7 +51,7 define([ | |||||
51 |
|
51 | |||
52 | CommManager.prototype.register_comm = function (comm) { |
|
52 | CommManager.prototype.register_comm = function (comm) { | |
53 | // Register a comm in the mapping |
|
53 | // Register a comm in the mapping | |
54 | this.comms[comm.comm_id] = comm; |
|
54 | this.comms[comm.comm_id] = new Promise(function(resolve) {resolve(comm);}); | |
55 | comm.kernel = this.kernel; |
|
55 | comm.kernel = this.kernel; | |
56 | return comm.comm_id; |
|
56 | return comm.comm_id; | |
57 | }; |
|
57 | }; | |
@@ -66,12 +66,13 define([ | |||||
66 | CommManager.prototype.comm_open = function (msg) { |
|
66 | CommManager.prototype.comm_open = function (msg) { | |
67 | var content = msg.content; |
|
67 | var content = msg.content; | |
68 | var that = this; |
|
68 | var that = this; | |
|
69 | var comm_id = content.comm_id; | |||
69 |
|
70 | |||
70 |
|
|
71 | this.comms[comm_id] = utils.load_class(content.target_name, content.target_module, | |
71 | this.targets).then(function(target) { |
|
72 | this.targets).then(function(target) { | |
72 |
|
73 | |||
73 |
var comm = new Comm(content.target_name, |
|
74 | var comm = new Comm(content.target_name, comm_id); | |
74 | that.register_comm(comm); |
|
75 | comm.kernel = that.kernel; | |
75 | try { |
|
76 | try { | |
76 | target(comm, msg); |
|
77 | target(comm, msg); | |
77 | } catch (e) { |
|
78 | } catch (e) { | |
@@ -83,33 +84,40 define([ | |||||
83 | } |
|
84 | } | |
84 | return comm; |
|
85 | return comm; | |
85 | }, utils.reject('Could not open comm', true)); |
|
86 | }, utils.reject('Could not open comm', true)); | |
|
87 | return this.comms[comm_id]; | |||
86 | }; |
|
88 | }; | |
87 |
|
89 | |||
88 |
CommManager.prototype.comm_close = function |
|
90 | CommManager.prototype.comm_close = function(msg) { | |
89 | var content = msg.content; |
|
91 | var content = msg.content; | |
90 |
|
|
92 | if (!this.comms[content.comm_id]) { | |
91 | if (comm === undefined) { |
|
93 | console.error('Comm promise not found for comm id ' + content.comm_id); | |
92 | return; |
|
94 | return; | |
93 | } |
|
95 | } | |
|
96 | ||||
|
97 | this.comms[content.comm_id].then(function(comm) { | |||
94 | this.unregister_comm(comm); |
|
98 | this.unregister_comm(comm); | |
95 | try { |
|
99 | try { | |
96 | comm.handle_close(msg); |
|
100 | comm.handle_close(msg); | |
97 | } catch (e) { |
|
101 | } catch (e) { | |
98 | console.log("Exception closing comm: ", e, e.stack, msg); |
|
102 | console.log("Exception closing comm: ", e, e.stack, msg); | |
99 | } |
|
103 | } | |
|
104 | }); | |||
100 | }; |
|
105 | }; | |
101 |
|
106 | |||
102 |
CommManager.prototype.comm_msg = function |
|
107 | CommManager.prototype.comm_msg = function(msg) { | |
103 | var content = msg.content; |
|
108 | var content = msg.content; | |
104 |
|
|
109 | if (!this.comms[content.comm_id]) { | |
105 | if (comm === undefined) { |
|
110 | console.error('Comm promise not found for comm id ' + content.comm_id); | |
106 | return; |
|
111 | return; | |
107 | } |
|
112 | } | |
|
113 | ||||
|
114 | this.comms[content.comm_id].then(function(comm) { | |||
108 | try { |
|
115 | try { | |
109 | comm.handle_msg(msg); |
|
116 | comm.handle_msg(msg); | |
110 | } catch (e) { |
|
117 | } catch (e) { | |
111 | console.log("Exception handling comm msg: ", e, e.stack, msg); |
|
118 | console.log("Exception handling comm msg: ", e, e.stack, msg); | |
112 | } |
|
119 | } | |
|
120 | }); | |||
113 | }; |
|
121 | }; | |
114 |
|
122 | |||
115 | //----------------------------------------------------------------------- |
|
123 | //----------------------------------------------------------------------- | |
@@ -182,8 +190,9 define([ | |||||
182 |
|
190 | |||
183 | Comm.prototype.handle_msg = function (msg) { |
|
191 | Comm.prototype.handle_msg = function (msg) { | |
184 | var that = this; |
|
192 | var that = this; | |
185 | this.msg_promise.then(function() { |
|
193 | this.msg_promise = this.msg_promise.then(function() { | |
186 | that._maybe_callback('msg', msg); |
|
194 | that._maybe_callback('msg', msg); | |
|
195 | return Promise.resolve(); | |||
187 | }); |
|
196 | }); | |
188 | }; |
|
197 | }; | |
189 |
|
198 |
@@ -26,9 +26,7 casper.notebook_test(function () { | |||||
26 | 'Widget float textbox exists.'); |
|
26 | 'Widget float textbox exists.'); | |
27 |
|
27 | |||
28 | this.cell_element_function(float_text.index, float_text.query, 'val', ['']); |
|
28 | this.cell_element_function(float_text.index, float_text.query, 'val', ['']); | |
29 | console.log('send keys'); |
|
|||
30 | this.sendKeys(float_text.query, '1.05'); |
|
29 | this.sendKeys(float_text.query, '1.05'); | |
31 | console.log('send keys done'); |
|
|||
32 | }); |
|
30 | }); | |
33 |
|
31 | |||
34 | this.wait_for_widget(float_text); |
|
32 | this.wait_for_widget(float_text); |
General Comments 0
You need to be logged in to leave comments.
Login now