##// END OF EJS Templates
Address @takluyver 's review comments
Jonathan Frederic -
Show More
@@ -661,7 +661,7 define([
661 661 });
662 662 };
663 663
664 var resolve_dict = function(d) {
664 var resolve_promises_dict = function(d) {
665 665 // Resolve a promiseful dictionary.
666 666 // Returns a single Promise.
667 667 var keys = Object.keys(d);
@@ -749,7 +749,7 define([
749 749 promising_ajax : promising_ajax,
750 750 WrappedError: WrappedError,
751 751 load_class: load_class,
752 resolve_dict: resolve_dict,
752 resolve_promises_dict: resolve_promises_dict,
753 753 reject: reject,
754 754 };
755 755
@@ -54,18 +54,12 define([
54 54 if (cell === null) {
55 55 reject(new Error("Could not determine where the display" +
56 56 " message was from. Widget will not be displayed"));
57 } else {
58 var dummy = null;
59 if (cell.widget_subarea) {
60 dummy = $('<div />');
61 cell.widget_subarea.append(dummy);
62 }
63
57 } else if (cell.widget_subarea) {
58 var dummy = $('<div />');
59 cell.widget_subarea.append(dummy);
64 60 that.create_view(model, {cell: cell}).then(function(view) {
65 61 that._handle_display_view(view);
66 if (dummy) {
67 dummy.replaceWith(view.$el);
68 }
62 dummy.replaceWith(view.$el);
69 63 view.trigger('displayed');
70 64 resolve(view);
71 65 }, function(error) {
@@ -178,6 +172,7 define([
178 172 };
179 173
180 174 WidgetManager.prototype.get_model = function (model_id) {
175 // Get a promise for a model by model id.
181 176 return this._models[model_id];
182 177 };
183 178
@@ -80,7 +80,7 define(["widgets/js/manager",
80 80 this.trigger('msg:custom', msg.content.data.content);
81 81 break;
82 82 case 'display':
83 this.widget_manager.display_view(msg, that);
83 this.widget_manager.display_view(msg, this);
84 84 break;
85 85 }
86 86 },
@@ -262,7 +262,7 define(["widgets/js/manager",
262 262 _.each(value, function(sub_value, key) {
263 263 unpacked[key] = that._unpack_models(sub_value);
264 264 });
265 return utils.resolve_dict(unpacked);
265 return utils.resolve_promises_dict(unpacked);
266 266 } else if (typeof value === 'string' && value.slice(0,10) === "IPY_MODEL_") {
267 267 // get_model returns a promise already
268 268 return this.widget_manager.get_model(value.slice(10, value.length));
General Comments 0
You need to be logged in to leave comments. Login now