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

Conversation

Projects
None yet
2 participants
@kevinsawicki
Copy link
Contributor

kevinsawicki commented Jul 14, 2016

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

kevinsawicki added some commits Jul 14, 2016

@kevinsawicki kevinsawicki force-pushed the webcontents-static-api branch from 57c8a94 to a4001fb Jul 14, 2016

@zcbenz

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

kevinsawicki commented Jul 15, 2016

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

This comment has been minimized.

Copy link
Member

zcbenz commented Jul 15, 2016

👍

@zcbenz zcbenz merged commit 9eacd07 into master Jul 15, 2016

2 of 6 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
electron-linux-x64 Build #3666972 started
Details
electron-mas-x64 Build #1949 in progress...
Details
electron-win-ia32 Build #953 in progress...
Details
electron-linux-arm Build #3666970 succeeded in 48s
Details
electron-linux-ia32 Build #3666971 succeeded in 42s
Details

@zcbenz zcbenz deleted the webcontents-static-api branch Jul 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.