jupyterlab-emrys
Version:
A computational environment for Jupyter. Powered by Emrys
89 lines (88 loc) • 2.77 kB
TypeScript
import { IDisposable } from 'phosphor-disposable';
import { IKernel } from 'jupyter-js-services';
/**
* The definition of a console history manager object.
*/
export interface IConsoleHistory extends IDisposable {
/**
* The current kernel supplying navigation history.
*/
kernel: IKernel;
/**
* Get the previous item in the console history.
*
* @returns A Promise for console command text or `undefined` if unavailable.
*/
back(): Promise<string>;
/**
* Get the next item in the console history.
*
* @returns A Promise for console command text or `undefined` if unavailable.
*/
forward(): Promise<string>;
/**
* Add a new item to the bottom of history.
*
* @param item The item being added to the bottom of history.
*
* #### Notes
* If the item being added is undefined or empty, it is ignored. If the item
* being added is the same as the last item in history, it is ignored as well
* so that the console's history will consist of no contiguous repetitions.
* This behavior varies from some shells, but the Jupyter Qt Console is
* implemented this way.
*/
push(item: string): void;
}
/**
* A console history manager object.
*/
export declare class ConsoleHistory implements IConsoleHistory {
/**
* Get whether the console history manager is disposed.
*
* #### Notes
* This is a read-only property.
*/
isDisposed: boolean;
/**
* The current kernel supplying navigation history.
*/
kernel: IKernel;
/**
* Construct a new console history object.
*/
constructor(kernel: IKernel);
/**
* Get the previous item in the console history.
*
* @returns A Promise for console command text or `undefined` if unavailable.
*/
back(): Promise<string>;
/**
* Dispose of the resources held by the console history manager.
*/
dispose(): void;
/**
* Get the next item in the console history.
*
* @returns A Promise for console command text or `undefined` if unavailable.
*/
forward(): Promise<string>;
/**
* Add a new item to the bottom of history.
*
* @param item The item being added to the bottom of history.
*
* #### Notes
* If the item being added is undefined or empty, it is ignored. If the item
* being added is the same as the last item in history, it is ignored as well
* so that the console's history will consist of no contiguous repetitions.
* This behavior varies from some shells, but the Jupyter Qt Console is
* implemented this way.
*/
push(item: string): void;
private _cursor;
private _history;
private _kernel;
}