Skip to content

Commit 9742b29

Browse files
authored
Merge pull request #1353 from pbugnion/fix-regression-output-area
Regression handling callback output
2 parents 24f0b63 + 1092068 commit 9742b29

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

widgetsnbextension/src/extension.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function register_events(Jupyter, events, outputarea) {
9696
var model = manager.get_model(data.model_id);
9797
if (model) {
9898
model.then(function(model) {
99-
return manager.display_model(void 0, model, void 0);
99+
return manager.display_model(void 0, model, {output: output});
100100
}).then(function(view) {
101101
var id = view.cid;
102102
output._jupyterWidgetViews = output._jupyterWidgetViews || [];

widgetsnbextension/src/manager.js

+25
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,31 @@ WidgetManager.prototype._get_connected_kernel = function() {
289289
});
290290
};
291291

292+
WidgetManager.prototype.setViewOptions = function (options) {
293+
var options = options || {};
294+
if (!options.output && options.parent) {
295+
// use the parent output if we don't have one
296+
options.output = options.parent.options.output;
297+
}
298+
options.iopub_callbacks = {
299+
output: options.output.handle_output.bind(options.output),
300+
clear_output: options.output.handle_clear_output.bind(options.output)
301+
}
302+
return options;
303+
};
304+
305+
/**
306+
* Callback handlers for a specific view
307+
*/
308+
WidgetManager.prototype.callbacks = function (view) {
309+
var callbacks = widgets.ManagerBase.prototype.callbacks.call(this, view);
310+
if (view && view.options.iopub_callbacks) {
311+
callbacks.iopub = view.options.iopub_callbacks
312+
}
313+
return callbacks;
314+
};
315+
316+
292317
module.exports = {
293318
WidgetManager: WidgetManager
294319
};

0 commit comments

Comments
 (0)