beaker-kernel
    Preparing search index...

    Interface IBeakerFuture<REQUEST, REPLY>

    interface IBeakerFuture<
        REQUEST extends IBeakerShellMessage = IBeakerShellMessage,
        REPLY extends IBeakerShellMessage = IBeakerShellMessage,
    > {
        done: Promise<REPLY>;
        isDisposed: boolean;
        msg: REQUEST;
        msgId?: string;
        onIOPub: (msg: IIOPubMessage) => void | PromiseLike<void>;
        onReply: (msg: REPLY) => void | PromiseLike<void>;
        onResponse?: (msg: any) => void | PromiseLike<void>;
        onStdin: (msg: IStdinMessage) => void | PromiseLike<void>;
        dispose(): void;
        registerMessageHook(
            hook: (msg: IIOPubMessage) => boolean | PromiseLike<boolean>,
        ): void;
        removeMessageHook(
            hook: (msg: IIOPubMessage) => boolean | PromiseLike<boolean>,
        ): void;
        sendInputReply(
            content: ReplyContent<IInputReply>,
            parent_header: IHeader<"input_request">,
        ): void;
    }

    Type Parameters

    Hierarchy

    Index

    Properties

    done: Promise<REPLY>

    A promise that resolves when the future is done.

    The future is done when there are no more responses expected from the kernel.

    The done promise resolves to the reply message.

    isDisposed: boolean

    Test whether the object has been disposed.

    This property is always safe to access.

    msg: REQUEST

    The original outgoing message.

    msgId?: string
    onIOPub: (msg: IIOPubMessage) => void | PromiseLike<void>

    The iopub handler for the kernel future.

    If the handler returns a promise, all kernel message processing pauses until the promise is resolved.

    onReply: (msg: REPLY) => void | PromiseLike<void>

    The reply handler for the kernel future.

    If the handler returns a promise, all kernel message processing pauses until the promise is resolved. If there is a reply message, the future done promise also resolves to the reply message after this handler has been called.

    onResponse?: (msg: any) => void | PromiseLike<void>
    onStdin: (msg: IStdinMessage) => void | PromiseLike<void>

    The stdin handler for the kernel future.

    If the handler returns a promise, all kernel message processing pauses until the promise is resolved.

    Methods

    • Dispose of the resources held by the object.

      If the object's dispose method is called more than once, all calls made after the first will be a no-op.

      It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

      Returns void

    • Register hook for IOPub messages.

      Parameters

      • hook: (msg: IIOPubMessage) => boolean | PromiseLike<boolean>

        The callback invoked for an IOPub message.

        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. A hook can return a boolean or a promise to a boolean, in which case all kernel message processing pauses until the promise is fulfilled. If a hook return value resolves to false, any later hooks will not run and the function will return a promise resolving to false. 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 will not run until the next message. If a hook is removed during the hook processing, it will be deactivated immediately.

      Returns void

    • Remove a hook for IOPub messages.

      Parameters

      • hook: (msg: IIOPubMessage) => boolean | PromiseLike<boolean>

        The hook to remove.

        If a hook is removed during the hook processing, it will be deactivated immediately.

      Returns void

    • Send an input_reply message.

      Parameters

      • content: ReplyContent<IInputReply>
      • parent_header: IHeader<"input_request">

      Returns void