Show More
@@ -54,7 +54,7 b' function(WidgetManager, Underscore, Backbone){' | |||||
54 | send: function (content, callbacks) { |
|
54 | send: function (content, callbacks) { | |
55 | // Send a custom msg over the comm. |
|
55 | // Send a custom msg over the comm. | |
56 | if (this.comm !== undefined) { |
|
56 | if (this.comm !== undefined) { | |
57 |
var data = {method: 'custom', |
|
57 | var data = {method: 'custom', content: content}; | |
58 | this.comm.send(data, callbacks); |
|
58 | this.comm.send(data, callbacks); | |
59 | } |
|
59 | } | |
60 | }, |
|
60 | }, | |
@@ -76,7 +76,7 b' function(WidgetManager, Underscore, Backbone){' | |||||
76 | this.apply_update(msg.content.data.state); |
|
76 | this.apply_update(msg.content.data.state); | |
77 | break; |
|
77 | break; | |
78 | case 'custom': |
|
78 | case 'custom': | |
79 |
this.trigger('msg:custom', msg.content.data. |
|
79 | this.trigger('msg:custom', msg.content.data.content); | |
80 | break; |
|
80 | break; | |
81 | case 'display': |
|
81 | case 'display': | |
82 | this.widget_manager.display_view(msg, this); |
|
82 | this.widget_manager.display_view(msg, this); |
@@ -153,7 +153,7 b' class Widget(LoggingConfigurable):' | |||||
153 | content : dict |
|
153 | content : dict | |
154 | Content of the message to send. |
|
154 | Content of the message to send. | |
155 | """ |
|
155 | """ | |
156 |
self._send({"method": "custom", " |
|
156 | self._send({"method": "custom", "content": content}) | |
157 |
|
157 | |||
158 | def on_msg(self, callback, remove=False): |
|
158 | def on_msg(self, callback, remove=False): | |
159 | """(Un)Register a custom msg recieve callback. |
|
159 | """(Un)Register a custom msg recieve callback. | |
@@ -249,8 +249,8 b' class Widget(LoggingConfigurable):' | |||||
249 |
|
249 | |||
250 | # Handle a custom msg from the front-end |
|
250 | # Handle a custom msg from the front-end | |
251 | elif method == 'custom': |
|
251 | elif method == 'custom': | |
252 |
if ' |
|
252 | if 'content' in data: | |
253 |
self._handle_custom_msg(data[' |
|
253 | self._handle_custom_msg(data['content']) | |
254 |
|
254 | |||
255 | def _handle_receive_state(self, sync_data): |
|
255 | def _handle_receive_state(self, sync_data): | |
256 | """Called when a state is received from the front-end.""" |
|
256 | """Called when a state is received from the front-end.""" |
General Comments 0
You need to be logged in to leave comments.
Login now