##// END OF EJS Templates
Updated comments to new style.
Jonathan Frederic -
Show More
@@ -60,28 +60,34 b' define(['
60 WidgetManager._save_callback = null;
60 WidgetManager._save_callback = null;
61
61
62 WidgetManager.register_widget_model = function (model_name, model_type) {
62 WidgetManager.register_widget_model = function (model_name, model_type) {
63 // Registers a widget model by name.
63 /**
64 * Registers a widget model by name.
65 */
64 WidgetManager._model_types[model_name] = model_type;
66 WidgetManager._model_types[model_name] = model_type;
65 };
67 };
66
68
67 WidgetManager.register_widget_view = function (view_name, view_type) {
69 WidgetManager.register_widget_view = function (view_name, view_type) {
68 // Registers a widget view by name.
70 /**
71 * Registers a widget view by name.
72 */
69 WidgetManager._view_types[view_name] = view_type;
73 WidgetManager._view_types[view_name] = view_type;
70 };
74 };
71
75
72 WidgetManager.set_state_callbacks = function (load_callback, save_callback, options) {
76 WidgetManager.set_state_callbacks = function (load_callback, save_callback, options) {
73 // Registers callbacks for widget state persistence.
77 /**
74 //
78 * Registers callbacks for widget state persistence.
75 // Parameters
79 *
76 // ----------
80 * Parameters
77 // load_callback: function()
81 * ----------
78 // function that is called when the widget manager state should be
82 * load_callback: function()
79 // loaded. This function should return a promise for the widget
83 * function that is called when the widget manager state should be
80 // manager state. An empty state is an empty dictionary `{}`.
84 * loaded. This function should return a promise for the widget
81 // save_callback: function(state as dictionary)
85 * manager state. An empty state is an empty dictionary `{}`.
82 // function that is called when the notebook is saved or autosaved.
86 * save_callback: function(state as dictionary)
83 // The current state of the widget manager is passed in as the first
87 * function that is called when the notebook is saved or autosaved.
84 // argument.
88 * The current state of the widget manager is passed in as the first
89 * argument.
90 */
85 WidgetManager._load_callback = load_callback;
91 WidgetManager._load_callback = load_callback;
86 WidgetManager._save_callback = save_callback;
92 WidgetManager._save_callback = save_callback;
87 WidgetManager._get_state_options = options;
93 WidgetManager._get_state_options = options;
@@ -313,23 +319,25 b' define(['
313 };
319 };
314
320
315 WidgetManager.prototype.get_state = function(options) {
321 WidgetManager.prototype.get_state = function(options) {
316 // Asynchronously get the state of the widget manager.
322 /**
317 //
323 * Asynchronously get the state of the widget manager.
318 // This includes all of the widget models and the cells that they are
324 *
319 // displayed in.
325 * This includes all of the widget models and the cells that they are
320 //
326 * displayed in.
321 // Parameters
327 *
322 // ----------
328 * Parameters
323 // options: dictionary
329 * ----------
324 // Dictionary of options with the following contents:
330 * options: dictionary
325 // only_displayed: (optional) boolean=false
331 * Dictionary of options with the following contents:
326 // Only return models with one or more displayed views.
332 * only_displayed: (optional) boolean=false
327 // not_live: (optional) boolean=false
333 * Only return models with one or more displayed views.
328 // Include models that have comms with severed connections.
334 * not_live: (optional) boolean=false
329 //
335 * Include models that have comms with severed connections.
330 // Returns
336 *
331 // -------
337 * Returns
332 // Promise for a state dictionary
338 * -------
339 * Promise for a state dictionary
340 */
333 var that = this;
341 var that = this;
334 return utils.resolve_promises_dict(this._models).then(function(models) {
342 return utils.resolve_promises_dict(this._models).then(function(models) {
335 var state = {};
343 var state = {};
@@ -366,10 +374,12 b' define(['
366 };
374 };
367
375
368 WidgetManager.prototype.set_state = function(state) {
376 WidgetManager.prototype.set_state = function(state) {
369 // Set the notebook's state.
377 /**
370 //
378 * Set the notebook's state.
371 // Reconstructs all of the widget models and attempts to redisplay the
379 *
372 // widgets in the appropriate cells by cell index.
380 * Reconstructs all of the widget models and attempts to redisplay the
381 * widgets in the appropriate cells by cell index.
382 */
373
383
374 // Get the kernel when it's available.
384 // Get the kernel when it's available.
375 var that = this;
385 var that = this;
@@ -423,7 +433,9 b' define(['
423 };
433 };
424
434
425 WidgetManager.prototype._get_connected_kernel = function() {
435 WidgetManager.prototype._get_connected_kernel = function() {
426 // Gets a promise for a connected kernel.
436 /**
437 * Gets a promise for a connected kernel
438 */
427 var that = this;
439 var that = this;
428 return new Promise(function(resolve, reject) {
440 return new Promise(function(resolve, reject) {
429 if (that.comm_manager &&
441 if (that.comm_manager &&
General Comments 0
You need to be logged in to leave comments. Login now