##// END OF EJS Templates
Fixed bug in throttling code.
Jonathan Frederic -
Show More
@@ -160,9 +160,13 b''
160 160 WidgetManager.prototype.callbacks = function (view) {
161 161 // callback handlers specific a view
162 162 var callbacks = {};
163 var cell = view.options.cell;
164 if (cell !== null) {
163 if (view !== undefined &&
164 view !== null &&
165 view.options.cell !== undefined &&
166 view.options.cell !== null) {
167
165 168 // Try to get output handlers
169 var cell = view.options.cell;
166 170 var handle_output = null;
167 171 var handle_clear_output = null;
168 172 if (cell.output_area !== undefined && cell.output_area !== null) {
@@ -56,6 +56,7 b' function(WidgetManager, Underscore, Backbone){'
56 56 if (this.comm !== undefined) {
57 57 var data = {method: 'custom', content: content};
58 58 this.comm.send(data, callbacks);
59 this.pending_msgs++;
59 60 }
60 61 },
61 62
@@ -158,7 +159,13 b' function(WidgetManager, Underscore, Backbone){'
158 159
159 160 // Only sync if there are attributes to send to the back-end.
160 161 if (_.size(attrs) > 0) {
161 var callbacks = options.callbacks || {};
162
163 // If this message was sent via backbone itself, it will not
164 // have any callbacks. It's important that we create callbacks
165 // so we can listen for status messages, etc...
166 var callbacks = options.callbacks || this.callbacks();
167
168 // Check throttle.
162 169 if (this.pending_msgs >= this.msg_throttle) {
163 170 // The throttle has been exceeded, buffer the current msg so
164 171 // it can be sent once the kernel has finished processing
@@ -181,8 +188,7 b' function(WidgetManager, Underscore, Backbone){'
181 188
182 189 } else {
183 190 // We haven't exceeded the throttle, send the message like
184 // normal. If this is a patch operation, just send the
185 // changes.
191 // normal.
186 192 var data = {method: 'backbone', sync_data: attrs};
187 193 this.comm.send(data, callbacks);
188 194 this.pending_msgs++;
@@ -176,7 +176,7 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
176 176 },
177 177
178 178 handleChanging: function(e) {
179 // Handles and validates user input.
179 // Handles user input.
180 180
181 181 // Calling model.set will trigger all of the other views of the
182 182 // model to update.
General Comments 0
You need to be logged in to leave comments. Login now