Skip to content

Commit

Permalink
Ensured kernel is defined before widget creates comm
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Sep 16, 2016
1 parent 1be51ee commit a864f9d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions holoviews/plotting/widgets/widgets.js
Expand Up @@ -98,9 +98,11 @@ HoloViewsWidget.prototype.update = function(current){

HoloViewsWidget.prototype.init_comms = function() {
var widget = this;
var comm_manager = Jupyter.notebook.kernel.comm_manager
comm = comm_manager.new_comm(this.id, {}, {}, {}, this.id);
comm.on_msg(function (msg) { widget.process_msg(msg) })
if ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel !== undefined)) {
var comm_manager = Jupyter.notebook.kernel.comm_manager
comm = comm_manager.new_comm(this.id, {}, {}, {}, this.id);
comm.on_msg(function (msg) { widget.process_msg(msg) })
}
}

HoloViewsWidget.prototype.process_msg = function(msg) {
Expand Down

0 comments on commit a864f9d

Please sign in to comment.