jupyterlab-emrys
Version:
A computational environment for Jupyter. Powered by Emrys
66 lines (65 loc) • 1.81 kB
TypeScript
import { IDisposable } from 'phosphor-disposable';
import { ISignal } from 'phosphor-signaling';
import { Widget } from 'phosphor-widget';
/**
* An object that tracks the active widget in an application.
*/
export declare class WidgetTracker<T extends Widget> implements IDisposable {
/**
* Construct a new widget tracker.
*/
constructor();
/**
* A signal emitted when the active widget changes.
*/
activeWidgetChanged: ISignal<WidgetTracker<T>, T>;
/**
* Test whether the widget tracker has been disposed.
*
* #### Notes
* This is a read-only property.
*/
isDisposed: boolean;
/**
* The read-only list of tracked widgets.
*
* #### Notes
* This is a read-only property.
*/
widgets: T[];
/**
* The currently active widget.
*
* #### Notes
* This is set automatically due to user events but can
* also be set programatically.
* The widget must be one of the current widgets.
* The widget will be activated in the application shell.
* The [[activeWidgetChanged]] signal will be emitted.
*/
activeWidget: T;
/**
* Dispose of the resources used by the tracker.
*/
dispose(): void;
/**
* Add a widget to the widget tracker.
*
* @param widget - The widget to add to the tracker.
*
* @returns A disposable that can be used to remove the widget from
* the tracker.
*
* #### Notes
* The new widget will be set as the active widget.
*/
addWidget(widget: T): IDisposable;
/**
* Handle the DOM events for the widget tracker.
*
* @param event - The DOM event sent to the widget.
*/
handleEvent(event: Event): void;
private _widgets;
private _activeWidget;
}