Show More
@@ -104,6 +104,7 b' define([' | |||||
104 | return Promise.resolve(view.render()).then(function() {return view;}); |
|
104 | return Promise.resolve(view.render()).then(function() {return view;}); | |
105 | }).catch(utils.reject("Couldn't create a view for model id '" + String(model.id) + "'", true)); |
|
105 | }).catch(utils.reject("Couldn't create a view for model id '" + String(model.id) + "'", true)); | |
106 | }); |
|
106 | }); | |
|
107 | model.views[utils.uuid()] = model.state_change; | |||
107 | return model.state_change; |
|
108 | return model.state_change; | |
108 | }; |
|
109 | }; | |
109 |
|
110 |
@@ -59,11 +59,12 b' define(["widgets/js/manager",' | |||||
59 | delete this.comm.model; // Delete ref so GC will collect widget model. |
|
59 | delete this.comm.model; // Delete ref so GC will collect widget model. | |
60 | delete this.comm; |
|
60 | delete this.comm; | |
61 | delete this.model_id; // Delete id from model so widget manager cleans up. |
|
61 | delete this.model_id; // Delete id from model so widget manager cleans up. | |
62 | for (var id in this.views) { |
|
62 | _.each(this.views, function(v, id, views) { | |
63 | if (this.views.hasOwnProperty(id)) { |
|
63 | v.then(function(view) { | |
64 |
|
|
64 | view.remove(); | |
65 | } |
|
65 | delete views[id]; | |
66 | } |
|
66 | }); | |
|
67 | }); | |||
67 | }, |
|
68 | }, | |
68 |
|
69 | |||
69 | _handle_comm_msg: function (msg) { |
|
70 | _handle_comm_msg: function (msg) { | |
@@ -292,8 +293,6 b' define(["widgets/js/manager",' | |||||
292 | // Public constructor. |
|
293 | // Public constructor. | |
293 | this.model.on('change',this.update,this); |
|
294 | this.model.on('change',this.update,this); | |
294 | this.options = parameters.options; |
|
295 | this.options = parameters.options; | |
295 | this.id = this.id || utils.uuid(); |
|
|||
296 | this.model.views[this.id] = this; |
|
|||
297 | this.on('displayed', function() { |
|
296 | this.on('displayed', function() { | |
298 | this.is_displayed = true; |
|
297 | this.is_displayed = true; | |
299 | }, this); |
|
298 | }, this); |
General Comments 0
You need to be logged in to leave comments.
Login now