diff --git a/IPython/html/static/notebook/js/widget.js b/IPython/html/static/notebook/js/widget.js index 2b39b0d..e7c667d 100644 --- a/IPython/html/static/notebook/js/widget.js +++ b/IPython/html/static/notebook/js/widget.js @@ -6,10 +6,10 @@ //---------------------------------------------------------------------------- //============================================================================ -// Cell +// Widget and WidgetManager bases //============================================================================ /** - * An extendable module that provide base functionnality to create cell for notebook. + * Base Widget classes * @module IPython * @namespace IPython * @submodule widget @@ -35,7 +35,7 @@ var IPython = (function (IPython) { var msg_types = ['widget_create', 'widget_destroy', 'widget_update']; for (var i = 0; i < msg_types.length; i++) { var msg_type = msg_types[i]; - kernel.register_iopub_handler(msg_type, $.proxy(this['handle_' + msg_type], this)); + kernel.register_iopub_handler(msg_type, $.proxy(this[msg_type], this)); } }; @@ -44,10 +44,8 @@ var IPython = (function (IPython) { this.widget_types[widget_type] = constructor; }; - WidgetManager.prototype.handle_widget_create = function (msg) { + WidgetManager.prototype.widget_create = function (msg) { var content = msg.content; - console.log("handle create", content); - console.log(this.widget_types); var constructor = this.widget_types[content.widget_type]; if (constructor === undefined) { console.log("No such widget type registered: ", content.widget_type); @@ -58,9 +56,8 @@ var IPython = (function (IPython) { this.widgets[content.widget_id] = widget; }; - WidgetManager.prototype.handle_widget_destroy = function (msg) { + WidgetManager.prototype.widget_destroy = function (msg) { var content = msg.content; - console.log("handle destroy", content); var widget = this.widgets[content.widget_id]; if (widget === undefined) { return; @@ -69,9 +66,8 @@ var IPython = (function (IPython) { widget.handle_destroy(content.data); }; - WidgetManager.prototype.handle_widget_update = function (msg) { + WidgetManager.prototype.widget_update = function (msg) { var content = msg.content; - console.log("handle update", content); var widget = this.widgets[content.widget_id]; if (widget === undefined) { return; @@ -84,27 +80,22 @@ var IPython = (function (IPython) { //----------------------------------------------------------------------- var Widget = function (kernel, content) { - console.log('widget!', this, kernel, content); this.kernel = kernel; + if (!content) return; this.widget_id = content.widget_id; this.handle_create(content.data); }; Widget.prototype.handle_create = function (data) { - // base class init does nothing - console.log("handle_create", this, data); }; Widget.prototype.handle_update = function (data) { - console.log("handle_update", this, data); }; Widget.prototype.handle_destroy = function (data) { - console.log("handle_destroy", this, data); }; Widget.prototype.update = function (data) { - console.log("update", this, data); var content = { widget_id : this.widget_id, data : data, @@ -114,7 +105,6 @@ var IPython = (function (IPython) { Widget.prototype.destroy = function (data) { - console.log("destroy", this, data); var content = { widget_id : this.widget_id, data : data,