Skip to content

Commit

Permalink
Use the view.cid unique id as an identifying id.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Apr 13, 2017
1 parent 00b16dc commit 17b7ae7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions widgetsnbextension/src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function register_events(Jupyter, events, outputarea) {
handle_kernel(Jupyter, data.kernel);
});

/**
* The views on this page. We keep this list so that we can call the view.remove()
* method when a view is removed from the page.
*/
var views = {};
var removeView = function(event, data) {
var output = data.cell.output_area;
Expand Down Expand Up @@ -90,9 +94,10 @@ function register_events(Jupyter, events, outputarea) {
model.then(function(model) {
return manager.display_model(void 0, model, void 0);
}).then(function(view) {
var id = view.cid;
output._jupyterWidgetViews = output._jupyterWidgetViews || [];
output._jupyterWidgetViews.push(view.id);
views[view.id] = view;
output._jupyterWidgetViews.push(id);
views[id] = view;
PhosphorWidget.Widget.attach(view.pWidget, node);
});
} else {
Expand Down

0 comments on commit 17b7ae7

Please sign in to comment.