Skip to content

ElectronContextBridge.exposeInMainWorld method

ElectronContextBridge › exposeInMainWorld

Unofficial

Exposes an API to the main world under window[apiKey]. The api is proxied across the context bridge so that the main world cannot mutate the isolated world's objects.

Signature:

exposeInMainWorld(apiKey: string, api: unknown): void

Parameters:

Parameter Type Description
apiKey string The key on window the api is exposed under.
api unknown The API object to expose. Modeled as unknown (the upstream type is any).

Returns: void