##// END OF EJS Templates
Move the display Promise into a lower level method,...
Jonathan Frederic -
Show More
@@ -93,7 +93,12 b' define(['
93 93
94 94 WidgetManager.prototype.create_view = function(model, options) {
95 95 // Creates a promise for a view of a given model
96 return utils.load_class(model.get('_view_name'), model.get('_view_module'),
96
97 // Make sure the view creation is not out of order with
98 // any state updates.
99 model.state_change = model.state_change.then(function() {
100 console.log('create_view ' + model.id);
101 return utils.load_class(model.get('_view_name'), model.get('_view_module'),
97 102 WidgetManager._view_types).then(function(ViewType) {
98 103
99 104 // If a view is passed into the method, use that view's cell as
@@ -109,6 +114,8 b' define(['
109 114 view.render();
110 115 return view;
111 116 }, utils.reject("Couldn't create a view for model id '" + String(model.id) + "'"));
117 });
118 return model.state_change;
112 119 };
113 120
114 121 WidgetManager.prototype.get_msg_cell = function (msg_id) {
@@ -81,9 +81,8 b' define(["widgets/js/manager",'
81 81 this.trigger('msg:custom', msg.content.data.content);
82 82 break;
83 83 case 'display':
84 this.state_change = this.state_change.then(function () {
85 return that.widget_manager.display_view(msg, that);
86 }).catch(utils.reject("Couldn't process display msg for model id '" + String(that.id) + "'", true));
84 that.widget_manager.display_view(msg, that)
85 .catch(utils.reject("Couldn't process display msg for model id '" + String(that.id) + "'", true));
87 86 break;
88 87 }
89 88 },
@@ -94,6 +93,8 b' define(["widgets/js/manager",'
94 93 return this._unpack_models(state).then(function(state) {
95 94 that.state_lock = state;
96 95 try {
96 console.log('set_state ' + that.id);
97 console.log(state);
97 98 WidgetModel.__super__.set.call(that, state);
98 99 } finally {
99 100 that.state_lock = null;
General Comments 0
You need to be logged in to leave comments. Login now