##// END OF EJS Templates
Check for null value
Sylvain Corlay -
Show More
@@ -355,7 +355,7 b' define(["widgets/js/manager",'
355 this.pending_msgs++;
355 this.pending_msgs++;
356 }
356 }
357 }
357 }
358 // Since the comm is a one-way communication, assume the message
358 // Since the comm is a one-way communication, assume the message
359 // arrived. Don't call success since we don't have a model back from the server
359 // arrived. Don't call success since we don't have a model back from the server
360 // this means we miss out on the 'sync' event.
360 // this means we miss out on the 'sync' event.
361 this._buffered_state_diff = {};
361 this._buffered_state_diff = {};
@@ -383,11 +383,13 b' define(["widgets/js/manager",'
383 for (var i=0; i<keys.length; i++) {
383 for (var i=0; i<keys.length; i++) {
384 var key = keys[i];
384 var key = keys[i];
385 var value = state[key];
385 var value = state[key];
386 if (value.buffer instanceof ArrayBuffer
386 if (value) {
387 || value instanceof ArrayBuffer) {
387 if (value.buffer instanceof ArrayBuffer
388 buffers.push(value);
388 || value instanceof ArrayBuffer) {
389 buffer_keys.push(key);
389 buffers.push(value);
390 delete state[key];
390 buffer_keys.push(key);
391 delete state[key];
392 }
391 }
393 }
392 }
394 }
393 that.comm.send({method: 'backbone', sync_data: state, buffer_keys: buffer_keys}, callbacks, {}, buffers);
395 that.comm.send({method: 'backbone', sync_data: state, buffer_keys: buffer_keys}, callbacks, {}, buffers);
@@ -396,7 +398,7 b' define(["widgets/js/manager",'
396 return (utils.reject("Couldn't send widget sync message", true))(error);
398 return (utils.reject("Couldn't send widget sync message", true))(error);
397 });
399 });
398 },
400 },
399
401
400 save_changes: function(callbacks) {
402 save_changes: function(callbacks) {
401 /**
403 /**
402 * Push this model's state to the back-end
404 * Push this model's state to the back-end
@@ -410,7 +412,7 b' define(["widgets/js/manager",'
410 /**
412 /**
411 * on_some_change(["key1", "key2"], foo, context) differs from
413 * on_some_change(["key1", "key2"], foo, context) differs from
412 * on("change:key1 change:key2", foo, context).
414 * on("change:key1 change:key2", foo, context).
413 * If the widget attributes key1 and key2 are both modified,
415 * If the widget attributes key1 and key2 are both modified,
414 * the second form will result in foo being called twice
416 * the second form will result in foo being called twice
415 * while the first will call foo only once.
417 * while the first will call foo only once.
416 */
418 */
General Comments 0
You need to be logged in to leave comments. Login now