Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KernelFutureHandler<REQUEST, REPLY>

Implementation of a kernel future.

If a reply is expected, the Future is considered done when both a reply message and an idle iopub status message have been received. Otherwise, it is considered done when the idle status is received.

Type parameters

Hierarchy

Implements

  • IDisposable
  • IFuture<REQUEST, REPLY>

Index

Constructors

constructor

  • new KernelFutureHandler(cb: function, msg: REQUEST, expectReply: boolean, disposeOnDone: boolean, kernel: IKernel): KernelFutureHandler
  • Construct a new KernelFutureHandler.

    Parameters

    • cb: function
        • (): void
        • Returns void

    • msg: REQUEST
    • expectReply: boolean
    • disposeOnDone: boolean
    • kernel: IKernel

    Returns KernelFutureHandler

Properties

Private _disposeOnDone

_disposeOnDone: boolean = true

Private _done

_done: PromiseDelegate<REPLY> = new PromiseDelegate<REPLY>()

Private _hooks

_hooks: HookList<IIOPubMessage<"clear_output" | "comm_close" | "comm_msg" | "comm_open" | "display_data" | "error" | "execute_input" | "execute_result" | "status" | "stream" | "update_display_data">> = new Private.HookList<KernelMessage.IIOPubMessage>()

Private _iopub

_iopub: function = Private.noOp

Type declaration

Private _kernel

_kernel: IKernel

Private _msg

_msg: REQUEST

Private _reply

_reply: function = Private.noOp

Type declaration

    • (msg: REPLY): void | PromiseLike<void>
    • Parameters

      • msg: REPLY

      Returns void | PromiseLike<void>

Private _replyMsg

_replyMsg: REPLY

Private _status

_status: number = 0

Private _stdin

_stdin: function = Private.noOp

Type declaration

isDisposed

isDisposed: boolean

Test whether the delegate has been disposed.

Accessors

done

  • get done(): Promise<REPLY>
  • A promise that resolves when the future is done.

    Returns Promise<REPLY>

msg

  • get msg(): REQUEST

onIOPub

  • get onIOPub(): function
  • set onIOPub(cb: function): void

onReply

  • get onReply(): function
  • set onReply(cb: function): void
  • Get the reply handler.

    Returns function

      • (msg: REPLY): void | PromiseLike<void>
      • Parameters

        • msg: REPLY

        Returns void | PromiseLike<void>

  • Set the reply handler.

    Parameters

    • cb: function
        • (msg: REPLY): void | PromiseLike<void>
        • Parameters

          • msg: REPLY

          Returns void | PromiseLike<void>

    Returns void

onStdin

  • get onStdin(): function
  • set onStdin(cb: function): void

Methods

Private _handleDone

  • _handleDone(): void

Private _handleIOPub

Private _handleReply

  • _handleReply(msg: REPLY): Promise<void>

Private _handleStdin

Private _setFlag

  • _setFlag(flag: KernelFutureFlag): void
  • Set the given future flag.

    Parameters

    • flag: KernelFutureFlag

    Returns void

Private _testFlag

  • _testFlag(flag: KernelFutureFlag): boolean
  • Test whether the given future flag is set.

    Parameters

    • flag: KernelFutureFlag

    Returns boolean

dispose

  • dispose(): void

handleMsg

  • handleMsg(msg: IMessage): Promise<void>

registerMessageHook

  • registerMessageHook(hook: function): void
  • Register hook for IOPub messages.

    Parameters

    • hook: function

      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. 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

removeMessageHook

  • removeMessageHook(hook: function): void
  • Remove a hook for IOPub messages.

    Parameters

    • hook: function

      The hook to remove.

      Notes

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

    Returns void

sendInputReply

Generated using TypeDoc