Configuration for a JSDOM environment.

interface IJSDOMConfiguration {
    get registrationCallbackName(): string;
    afterEnvSetup(
        url: string,
        fileURLs: readonly string[],
        renderAPI: RenderAPI,
        vmContext?: any,
    ): Promise<undefined | null | ICloseable>;
    getFileList(
        url: string,
        renderAPI: RenderAPI,
        fetchFn: (
            url: string,
        ) => undefined | null | Promise<Buffer<ArrayBufferLike>>,
    ): Promise<string[]>;
    getResourceLoader(
        url: string,
        renderAPI: RenderAPI,
    ): CloseableResourceLoader;
}

Implemented by

Accessors

Methods

  • Perform any additional environment setup.

    This method gets access to the actual environment in which code will execute. Be careful what you do.

    Parameters

    • url: string

      The URL that is to be rendered.

    • fileURLs: readonly string[]
    • renderAPI: RenderAPI

      An API of utilities for assisting with the render operation.

    • OptionalvmContext: any

      The actual environment that is being setup.

    Returns Promise<undefined | null | ICloseable>

    A promise that the additional setup is done.

  • Get the list of file URLs to retrieve and execute for the given request.

    Parameters

    • url: string

      The URL that is to be rendered.

    • renderAPI: RenderAPI

      An API of utilities for assisting with the render operation.

    • fetchFn: (url: string) => undefined | null | Promise<Buffer<ArrayBufferLike>>

      Function to fetch a URL. Using this ensures proper tidy-up of associated sockets and agents.

    Returns Promise<string[]>

    An ordered array of absolute URLs for the JavaScript files that are to be executed. These are exectued in the same order as the array.

  • Get a JSDOM resource loader for the given render request.

    Parameters

    • url: string

      The URL that is to be rendered.

    • renderAPI: RenderAPI

      An API of utilities for assisting with the render operation.

    Returns CloseableResourceLoader

    A ResourceLoader instance for use with JSDOM that can optionally have a close() method, which will be invoked when the render completes.