UNPKG

jupyterlab-emrys

Version:

A computational environment for Jupyter. Powered by Emrys

100 lines (99 loc) 2.74 kB
import { IKernel, KernelMessage } from 'jupyter-js-services'; import { IDisposable } from 'phosphor-disposable'; import { ISignal } from 'phosphor-signaling'; import { IListChangedArgs } from '../../common/observablelist'; import { nbformat } from '../notebook/nbformat'; /** * An model that maintains a list of output data. */ export declare class OutputAreaModel implements IDisposable { /** * Construct a new observable outputs instance. */ constructor(); /** * A signal emitted when the model changes. */ changed: ISignal<OutputAreaModel, IListChangedArgs<OutputAreaModel.Output>>; /** * A signal emitted when the model is disposed. */ disposed: ISignal<OutputAreaModel, void>; /** * Get the length of the items in the model. * * #### Notes * This is a read-only property. */ length: number; /** * Test whether the model is disposed. * * #### Notes * This is a read-only property. */ isDisposed: boolean; /** * Dispose of the resources used by the model. */ dispose(): void; /** * Get an item at the specified index. */ get(index: number): OutputAreaModel.Output; /** * Add an output, which may be combined with previous output. * * #### Notes * The output bundle is copied. * Contiguous stream outputs of the same `name` are combined. */ add(output: OutputAreaModel.Output): number; /** * Clear all of the output. * * @param wait Delay clearing the output until the next message is added. */ clear(wait?: boolean): OutputAreaModel.Output[]; /** * Execute code on a kernel and send outputs to the model. */ execute(code: string, kernel: IKernel): Promise<KernelMessage.IExecuteReplyMsg>; /** * Handle a change to the list. */ private _onListChanged(sender, args); private _clearNext; private _list; } /** * A namespace for OutputAreaModel statics. */ export declare namespace OutputAreaModel { /** * Output for an input request from the kernel. */ interface IInputRequest { /** * Type of cell output. */ output_type: 'input_request'; /** * The text to show at the prompt. */ prompt: string; /** * Whether the request is for a password. * If so, the frontend shouldn't echo input. */ password: boolean; /** * The kernel that made the request, used to send an input response. */ kernel: IKernel; } /** * A valid output area item. */ type Output = nbformat.IOutput | IInputRequest; }