The type of widget being tracked. Defaults to Widget
.
The API surface area of this concrete implementation is substantially larger than the widget tracker interface it implements. The interface is intended for export by JupyterLab plugins that create widgets and have clients who may wish to keep track of newly created widgets. This class, however, can be used internally by plugins to restore state as well.
Create a new widget tracker.
The instantiation options for a widget tracker.
A namespace for all tracked widgets, (e.g., notebook
).
A signal emitted when the current widget changes.
The current widget is the most recently focused or added widget.
It is the most recently focused widget, or the most recently added widget if no widget has taken focus.
Test whether the tracker is disposed.
A promise resolved when the tracker has been restored.
The number of widgets held by the tracker.
A signal emitted when a widget is added.
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.
A signal emitted when a widget is updated.
Add a new widget to the tracker.
The widget being added.
The widget passed into the tracker is added synchronously; its existence in
the tracker can be checked with the has()
method. The promise this method
returns resolves after the widget has been added and saved to an underlying
restoration connector, if one is available.
Dispose of the resources held by the tracker.
Filter the widgets in the tracker based on a predicate.
The function by which to filter.
Find the first widget in the tracker that satisfies a filter function.
Iterate through each widget in the tracker.
The function to call on each widget.
Check if this tracker has the specified widget.
The widget whose existence is being checked.
Inject a foreign widget into the widget tracker.
The widget to inject into the tracker.
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.
Handle the current change event.
The default implementation is a no-op.
Restore the widgets in this tracker's namespace.
The configuration options that describe restoration.
A promise that resolves when restoration has completed.
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.
The widget being saved.
Generated using TypeDoc
A class that keeps track of widget instances on an Application shell. A namespace for
WidgetTracker
statics.