Skip to content

ElectronWebContentsModule

Unofficial

The webContents module accessor exposed by Electron, providing static factory and lookup methods for WebContents instances.

Import:

import type { ElectronWebContentsModule } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface ElectronWebContentsModule

Methods

Method Returns Description
fromDevToolsTargetId(targetId) ElectronWebContents | undefined Looks up a WebContents instance based on its assigned Chrome DevTools Protocol TargetID.
fromFrame(frame) ElectronWebContents | undefined Looks up a WebContents instance based on a WebFrameMain.
fromId(id) ElectronWebContents | undefined Looks up a WebContents instance based on its ID.
getAllWebContents() ElectronWebContents[] Returns an array of all WebContents instances. This will contain web contents for all windows, webviews, opened devtools, and devtools extension background pages.
getFocusedWebContents() ElectronWebContents | null Returns the web contents that is focused in this application, otherwise returns null.

Links to this page: