mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-13 13:17:50 +08:00
Note todos for widgets
This commit is contained in:
parent
38f0135522
commit
1bf8da0734
@ -95,10 +95,9 @@
|
||||
var view = new ViewType({model: model, widget_manager: this, cell: cell});
|
||||
view.render();
|
||||
model.views.push(view);
|
||||
model.on('destroy', view.remove, view);
|
||||
/*
|
||||
// jng: Handle when the view element is remove from the page.
|
||||
// observe the view destruction event and do this. We may need
|
||||
// to override the view's remove method to trigger this event.
|
||||
// TODO: handle view deletion. Don't forget to delete child views
|
||||
var that = this;
|
||||
view.$el.on("remove", function () {
|
||||
var index = that.views.indexOf(view);
|
||||
@ -109,7 +108,7 @@
|
||||
|
||||
// Close the comm if there are no views left.
|
||||
if (that.views.length() === 0) {
|
||||
//jng: trigger comm close event
|
||||
//trigger comm close event?
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,6 @@ function(widget_manager, underscore, backbone){
|
||||
comm.on_close($.proxy(this._handle_comm_closed, this));
|
||||
comm.on_msg($.proxy(this._handle_comm_msg, this));
|
||||
}
|
||||
|
||||
return Backbone.Model.apply(this);
|
||||
},
|
||||
|
||||
@ -54,12 +53,11 @@ function(widget_manager, underscore, backbone){
|
||||
|
||||
// Handle when a widget is closed.
|
||||
_handle_comm_closed: function (msg) {
|
||||
// jng: widget manager should observe the comm_close event and delete views when triggered
|
||||
|
||||
this.trigger('comm:close');
|
||||
delete this.comm.model; // Delete ref so GC will collect widget model.
|
||||
delete this.comm;
|
||||
delete this.widget_id; // Delete id from model so widget manager cleans up.
|
||||
// TODO: Handle deletion, like this.destroy(), and delete views, etc.
|
||||
},
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user