import { Kernel, KernelMessage } from '@jupyterlab/services'; import { IDisposable } from '@phosphor/disposable'; import { BaseCellWidget, CodeCellWidget } from '../cells'; /** * A handler for capturing API messages from other sessions that should be * rendered in a given parent. */ export declare class ForeignHandler implements IDisposable { /** * Construct a new foreign message handler. */ constructor(options: ForeignHandler.IOptions); /** * Set whether the handler is able to inject foreign cells into a console. */ enabled: boolean; /** * The kernel used by the foreign handler. */ kernel: Kernel.IKernel; /** * The foreign handler's parent receiver. */ readonly parent: ForeignHandler.IReceiver; /** * Test whether the handler is disposed. */ readonly isDisposed: boolean; /** * Dispose the resources held by the handler. */ dispose(): void; /** * Handler IOPub messages. * * @returns `true` if the message resulted in a new cell injection or a * previously injected cell being updated and `false` for all other messages. */ protected onIOPubMessage(sender: Kernel.IKernel, msg: KernelMessage.IIOPubMessage): boolean; /** * Create a new code cell for an input originated from a foreign session. */ private _newCell(parentMsgId); private _cells; private _enabled; private _kernel; private _parent; private _factory; } /** * A namespace for `ForeignHandler` statics. */ export declare namespace ForeignHandler { /** * The instantiation options for a foreign handler. */ interface IOptions { /** * The kernel that the handler will listen to. */ kernel: Kernel.IKernel; /** * The parent into which the handler will inject code cells. */ parent: IReceiver; /** * The cell factory for foreign handlers. */ cellFactory: () => CodeCellWidget; } /** * A receiver of newly created foreign cells. */ interface IReceiver { /** * Add a newly created foreign cell. */ addCell(cell: BaseCellWidget): void; /** * Trigger a rendering update on the receiver. */ update(): void; } }