Datalayer VS Code Extension - v0.0.17
    Preparing search index...

    Type-safe message handler with async/await support. Handles bidirectional communication between webview and extension.

    Index

    Constructors

    Properties

    instance: MessageHandler = ...

    Singleton instance of MessageHandler.

    Methods

    • Register a callback to receive all messages from the extension. Returns a disposable to unregister the callback.

      Parameters

      • callback: (message: unknown) => void

        Function to call when messages are received.

      Returns Disposable

      Disposable to unregister the callback.

    • Send a request to the extension and wait for response.

      Type Parameters

      • TRequest = unknown
      • TResponse = unknown

      Parameters

      • message: TRequest

        Data payload to send to the extension host.

      • timeout: number = ...

        Maximum wait time in milliseconds before rejecting (default: 30000).

      Returns Promise<TResponse>

      Promise resolving to response message.

    • Send a message to the extension (fire and forget).

      Type Parameters

      • T = unknown

      Parameters

      • message: T

        Message to send.

      Returns void