Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document static methods on webContents #6489

Merged
merged 10 commits into from Jul 15, 2016
Merged

Document static methods on webContents #6489

merged 10 commits into from Jul 15, 2016

Conversation

kevinsawicki
Copy link
Contributor

This pull requests documents two new public API:

  • webContents.getAllWebContents() (similar to BrowserWindow.getAllWindows())
  • webContents.getFocusedWebContents() (similar to BrowserWindow.getFocusedWindow()

Also adds an initial spec for webContents static APIs.

@kevinsawicki kevinsawicki changed the title Document static methods no webContents Document static methods on webContents Jul 14, 2016
@zcbenz
Copy link
Member

zcbenz commented Jul 15, 2016

The webContents is actually a module not a class, and WebContents is the class. So the docs should look like:

# webContents

## Methods

### `webContents.fromId(id)`

## Class: WebContents

### Instance Methods

#### `contents.loadURL(url)`

The architecture is the same with session module. We didn't make this clear because the webContents behaved more like a property of BrowserWindow instead of an independent module. And we can not use webContents for the instance of WebContents class anymore since it is now the module's name.

@kevinsawicki
Copy link
Contributor Author

kevinsawicki commented Jul 15, 2016

The webContents is actually a module not a class, and WebContents is the class. So the docs should look like

Yeah, I did it this way initially to keep it consistent with the current layout of BrowserWindow's docs.

https://github.com/electron/electron/blob/master/docs/api/browser-window.md#static-methods

I'm up for refactoring them to the new format, but I thought we would probably do them all at once conforming to the new styleguide.

@zcbenz
Copy link
Member

zcbenz commented Jul 15, 2016

The electron.BrowserWindow returns the class, while electron.webContents and electron.session return the modules. So BrowserWindow has static methods, while webContents and session have module methods.

The essential difference between BrowserWindow module and webContents/session modules is, the BrowserWindow has to be created through its constructor, while WebContents and Session are usually created implicitly or can be created through module methods like session.create() or webContents.create().

@kevinsawicki
Copy link
Contributor Author

The essential difference between BrowserWindow module and webContents/session modules is, the BrowserWindow has to be created through its constructor, while WebContents and Session are usually created implicitly or can be created through module methods like session.create() or webContents.create().

Yup, thanks for clarifying 👍 I've updated all the sections to follow the styleguide.

@zcbenz
Copy link
Member

zcbenz commented Jul 15, 2016

👍

@zcbenz zcbenz merged commit 9eacd07 into master Jul 15, 2016
@zcbenz zcbenz deleted the webcontents-static-api branch July 15, 2016 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants