##// END OF EJS Templates
Added some small comments to widget code
Jonathan Frederic -
Show More
@@ -166,6 +166,7 b''
166 };
166 };
167
167
168 WidgetManager.prototype.get_model = function (model_id) {
168 WidgetManager.prototype.get_model = function (model_id) {
169 // Look-up a model instance by its id.
169 var model = this._models[model_id];
170 var model = this._models[model_id];
170 if (model !== undefined && model.id == model_id) {
171 if (model !== undefined && model.id == model_id) {
171 return model;
172 return model;
@@ -174,6 +175,7 b''
174 };
175 };
175
176
176 WidgetManager.prototype._handle_comm_open = function (comm, msg) {
177 WidgetManager.prototype._handle_comm_open = function (comm, msg) {
178 // Handle when a comm is opened.
177 var model_id = comm.comm_id;
179 var model_id = comm.comm_id;
178 var widget_type_name = msg.content.target_name;
180 var widget_type_name = msg.content.target_name;
179 var widget_model = new WidgetManager._model_types[widget_type_name](this, model_id, comm);
181 var widget_model = new WidgetManager._model_types[widget_type_name](this, model_id, comm);
@@ -132,6 +132,7 b' function(WidgetManager, Underscore, Backbone){'
132 },
132 },
133
133
134 sync: function (method, model, options) {
134 sync: function (method, model, options) {
135 // Handle sync to the back-end. Called when a model.save() is called.
135
136
136 // Make sure a comm exists.
137 // Make sure a comm exists.
137 var error = options.error || function() {
138 var error = options.error || function() {
@@ -315,7 +316,6 b' function(WidgetManager, Underscore, Backbone){'
315 touch: function () {
316 touch: function () {
316 this.model.save_changes(this.callbacks());
317 this.model.save_changes(this.callbacks());
317 },
318 },
318
319 });
319 });
320
320
321
321
General Comments 0
You need to be logged in to leave comments. Login now