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:

ParameterTypeDescription
apiKeystringThe key on window the api is exposed under.
apiunknownThe API object to expose. Modeled as unknown (the upstream type is any).

Returns: void