@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...

    Interface WebviewViewSurface

    One incarnation of a webview contributed to a view container.

    A view is not a single long-lived object: hiding it tears the webview down, and showing it again builds a new one and asks the provider to fill it in afresh. onDidDispose marks the end of this incarnation, which is what makes per-incarnation state — an RPC channel, message subscriptions, in-flight requests — releasable at the right moment rather than at shutdown.

    interface WebviewViewSurface {
        cspSource: string;
        asWebviewUri(extensionRelativePath: string): string;
        onDidDispose(listener: () => void): PlatformRegistration;
        onDidReceiveMessage(
            listener: (message: unknown) => void,
        ): PlatformRegistration;
        postMessage(message: unknown): Promise<boolean>;
        setHtml(html: string): void;
    }

    Hierarchy

    • WebviewSurface
      • WebviewViewSurface
    Index
    cspSource: string

    The source a content security policy has to allow for this webview.

    • Rewrites a path inside the extension into a uri the content may load.

      Takes a path rather than a uri so nothing above the port has to construct one — building a uri is exactly the sort of thing only the platform can do correctly for remote and virtual file systems.

      Parameters

      • extensionRelativePath: string

      Returns string

    • Sends a raw message to the content.

      Parameters

      • message: unknown

      Returns Promise<boolean>