##// END OF EJS Templates
Merge pull request #7093 from jasongrout/model-views...
Jonathan Frederic -
r19246:e3ab8f24 merge
parent child Browse files
Show More
@@ -112,6 +112,7 b' define(['
112 return Promise.resolve(view.render()).then(function() {return view;});
112 return Promise.resolve(view.render()).then(function() {return view;});
113 }).catch(utils.reject("Couldn't create a view for model id '" + String(model.id) + "'", true));
113 }).catch(utils.reject("Couldn't create a view for model id '" + String(model.id) + "'", true));
114 });
114 });
115 model.views[utils.uuid()] = model.state_change;
115 return model.state_change;
116 return model.state_change;
116 };
117 };
117
118
@@ -65,11 +65,12 b' define(["widgets/js/manager",'
65 delete this.comm.model; // Delete ref so GC will collect widget model.
65 delete this.comm.model; // Delete ref so GC will collect widget model.
66 delete this.comm;
66 delete this.comm;
67 delete this.model_id; // Delete id from model so widget manager cleans up.
67 delete this.model_id; // Delete id from model so widget manager cleans up.
68 for (var id in this.views) {
68 _.each(this.views, function(v, id, views) {
69 if (this.views.hasOwnProperty(id)) {
69 v.then(function(view) {
70 this.views[id].remove();
70 view.remove();
71 }
71 delete views[id];
72 }
72 });
73 });
73 },
74 },
74
75
75 _handle_comm_msg: function (msg) {
76 _handle_comm_msg: function (msg) {
@@ -318,8 +319,6 b' define(["widgets/js/manager",'
318 */
319 */
319 this.model.on('change',this.update,this);
320 this.model.on('change',this.update,this);
320 this.options = parameters.options;
321 this.options = parameters.options;
321 this.id = this.id || utils.uuid();
322 this.model.views[this.id] = this;
323 this.on('displayed', function() {
322 this.on('displayed', function() {
324 this.is_displayed = true;
323 this.is_displayed = true;
325 }, this);
324 }, this);
General Comments 0
You need to be logged in to leave comments. Login now