An object that tracks notebook widgets.

Hierarchy (view full)

Implements

Constructors

Properties

_activeCell: null | Cell<ICellModel> = null
_activeCellChanged: Signal<NotebookTracker, null | Cell<ICellModel>> = ...
_selectionChanged: Signal<NotebookTracker, void> = ...
namespace: string

A namespace for all tracked widgets, (e.g., notebook).

Accessors

  • get currentChanged(): ISignal<this, null | T>
  • A signal emitted when the current widget changes.

    Returns ISignal<this, null | T>

  • get currentWidget(): null | T
  • The current widget is the most recently focused or added widget.

    Notes

    It is the most recently focused widget, or the most recently added widget if no widget has taken focus.

    Returns null | T

  • get isDisposed(): boolean
  • Test whether the tracker is disposed.

    Returns boolean

  • get restored(): Promise<void>
  • A promise resolved when the tracker has been restored.

    Returns Promise<void>

  • get size(): number
  • The number of widgets held by the tracker.

    Returns number

  • get widgetAdded(): ISignal<this, T>
  • A signal emitted when a widget is added.

    Notes

    This signal will only fire when a widget is added to the tracker. It will not fire if a widget is injected into the tracker.

    Returns ISignal<this, T>

  • get widgetUpdated(): ISignal<this, T>
  • A signal emitted when a widget is updated.

    Returns ISignal<this, T>

Methods

  • Save the restore options for this tracker, but do not restore yet.

    Parameters

    • options: IRestorable.IOptions<NotebookPanel>

      The configuration options that describe restoration.

      Notes

      This function is useful when starting the shell in 'single-document' mode, to avoid restoring all useless widgets. It should not ordinarily be called by client code.

    Returns void

  • Find the first widget in the tracker that satisfies a filter function.

    Parameters

    • fn: ((widget) => boolean)

      The filter function to call on each widget.

      Notes

      If no widget is found, the value returned is undefined.

    Returns undefined | NotebookPanel

  • Iterate through each widget in the tracker.

    Parameters

    • fn: ((widget) => void)

      The function to call on each widget.

    Returns void

  • Check if this tracker has the specified widget.

    Parameters

    • widget: Widget

      The widget whose existence is being checked.

    Returns boolean

  • Inject a foreign widget into the widget tracker.

    Parameters

    • widget: NotebookPanel

      The widget to inject into the tracker.

      Notes

      Injected widgets will not have their state saved by the tracker.

      The primary use case for widget injection is for a plugin that offers a sub-class of an extant plugin to have its instances share the same commands as the parent plugin (since most relevant commands will use the currentWidget of the parent plugin's widget tracker). In this situation, the sub-class plugin may well have its own widget tracker for layout and state restoration in addition to injecting its widgets into the parent plugin's widget tracker.

    Returns Promise<void>

  • Restore the widgets in this tracker's namespace.

    Parameters

    Returns Promise<any>

    A promise that resolves when restoration has completed.

    Notes

    This function should not typically be invoked by client code. Its primary use case is to be invoked by a restorer.

  • Save the restore data for a given widget.

    Parameters

    Returns Promise<void>