import { DisposableDelegate } from 'phosphor/lib/core/disposable'; import { Kernel } from './kernel'; import { KernelMessage } from './messages'; /** * Implementation of a kernel future. */ export declare class KernelFutureHandler extends DisposableDelegate implements Kernel.IFuture { /** * Construct a new KernelFutureHandler. */ constructor(cb: () => void, msg: KernelMessage.IShellMessage, expectShell: boolean, disposeOnDone: boolean); /** * Get the original outgoing message. */ readonly msg: KernelMessage.IShellMessage; /** * Check for message done state. */ readonly isDone: boolean; /** * Get the reply handler. */ /** * Set the reply handler. */ onReply: (msg: KernelMessage.IShellMessage) => void; /** * Get the iopub handler. */ /** * Set the iopub handler. */ onIOPub: (msg: KernelMessage.IIOPubMessage) => void; /** * Get the done handler. */ /** * Set the done handler. */ onDone: () => void; /** * Get the stdin handler. */ /** * Set the stdin handler. */ onStdin: (msg: KernelMessage.IStdinMessage) => void; /** * Register hook for IOPub messages. * * @param hook - The callback invoked for an IOPub message. * * #### Notes * The IOPub hook system allows you to preempt the handlers for IOPub messages handled * by the future. The most recently registered hook is run first. * If the hook returns false, any later hooks and the future's onIOPub handler will not run. * If a hook throws an error, the error is logged to the console and the next hook is run. * If a hook is registered during the hook processing, it won't run until the next message. * If a hook is removed during the hook processing, it will be deactivated immediately. */ registerMessageHook(hook: (msg: KernelMessage.IIOPubMessage) => boolean): void; /** * Remove a hook for IOPub messages. * * @param hook - The hook to remove. * * #### Notes * If a hook is removed during the hook processing, it will be deactivated immediately. */ removeMessageHook(hook: (msg: KernelMessage.IIOPubMessage) => boolean): void; /** * Dispose and unregister the future. */ dispose(): void; /** * Handle an incoming kernel message. */ handleMsg(msg: KernelMessage.IMessage): void; private _handleReply(msg); private _handleStdin(msg); private _handleIOPub(msg); private _handleDone(); /** * Test whether the given future flag is set. */ private _testFlag(flag); /** * Set the given future flag. */ private _setFlag(flag); private _msg; private _status; private _stdin; private _iopub; private _reply; private _done; private _hooks; private _disposeOnDone; }