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

feat: promisify win.capturePage() #15743

Merged
merged 8 commits into from Nov 28, 2018

address docs feedback

  • Loading branch information...
codebytere committed Nov 26, 2018
commit 7063cd94536a1b69aa7246282335bccc54397cf2
@@ -1208,18 +1208,23 @@ Returns `Boolean` - Whether the window's document has been edited.

#### `win.capturePage([rect, ]callback)`
This conversation was marked as resolved by codebytere

This comment has been minimized.

Copy link
@MarshallOfSound

MarshallOfSound Nov 26, 2018

Member

Can we add

**[Deprecated Soon](Promisification.md)**

here so that it links to the promise doc when it lands


* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
* `callback` Function
* `image` [NativeImage](native-image.md)

Same as `webContents.capturePage([rect, ]callback)`.
Captures a snapshot of the page within `rect`. Upon completion `callback` will
be called with `callback(image)`. The `image` is an instance of [NativeImage](native-image.md)
that stores data of the snapshot. Omitting `rect` will capture the whole visible page.

**[Deprecated Soon](promisification.md)**

#### `win.capturePage([rect])`

* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture

* Returns `Promise<NativeImage>` - Returns [NativeImage](native-image.md)
* Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)

Same as `webContents.capturePage(rect)`.
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.

#### `win.loadURL(url[, options])`

@@ -1050,22 +1050,23 @@ console.log(requestId)

#### `contents.capturePage([rect, ]callback)`

* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
* `callback` Function
* `image` [NativeImage](native-image.md)

Captures a snapshot of the page within `rect`. Upon completion `callback` will
be called with `callback(image)`. The `image` is an instance of [NativeImage](native-image.md)
that stores data of the snapshot. Omitting `rect` will capture the whole visible page.

This comment has been minimized.

Copy link
@felixrieseberg

felixrieseberg Nov 27, 2018

Member

that stores data of the snapshot could be clearer, but that's the only thing I could find with this PR. The rest looks and it's honestly a nit.


**[Deprecated Soon](promisification.md)**

#### `contents.capturePage([rect])`

* `rect` [Rectangle](structures/rectangle.md) (optional) - The area of the page to be captured.

* Returns `Promise<NativeImage>` - Returns [NativeImage](native-image.md)
* Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)

Captures a snapshot of the page within `rect`. The promise will will be resolved with an `image`,
where `image` is an instance of [NativeImage](native-image.md) that stores data of the snapshot.
Omitting `rect` will capture the whole visible page.
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.

#### `contents.hasServiceWorker(callback)`

@@ -540,18 +540,23 @@ Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options, cal

### `<webview>.capturePage([rect, ]callback)`

* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
* `callback` Function
* `image` [NativeImage](native-image.md)

Captures a snapshot of the `webview`'s page. Same as `webContents.capturePage([rect, ]callback)`.
Captures a snapshot of the page within `rect`. Upon completion `callback` will
be called with `callback(image)`. The `image` is an instance of [NativeImage](native-image.md)
that stores data of the snapshot. Omitting `rect` will capture the whole visible page.

**[Deprecated Soon](promisification.md)**

### `<webview>.capturePage([rect])`

* `rect` [Rectangle](structures/rectangle.md) (optional) - The area of the page to be captured.

* Returns `Promise<NativeImage>` - Returns [NativeImage](native-image.md)
* Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)

Captures a snapshot of the `webview`'s page. Same as `webContents.capturePage(rect)`.
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.

### `<webview>.send(channel[, arg1][, arg2][, ...])`

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.