feat: add webContents.getPrintersAsync() (#31023)

This deprecates the synchronous and blocking `webContents.getPrinters()`
function and introduces `webContents.getPrintersAsync()`, which is
asynchronous and non-blocking.

Signed-off-by: Darshan Sen <darshan.sen@postman.com>
This commit is contained in:
Darshan Sen 2021-10-25 23:46:58 +05:30 committed by GitHub
parent b936f5e14a
commit 8f51d3e1bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 70 additions and 4 deletions

View file

@ -1369,12 +1369,20 @@ Decrease the capturer count by one. The page will be set to hidden or occluded s
browser window is hidden or occluded and the capturer count reaches zero. If you want to
decrease the hidden capturer count instead you should set `stayHidden` to true.
#### `contents.getPrinters()`
#### `contents.getPrinters()` _Deprecated_
Get the system printer list.
Returns [`PrinterInfo[]`](structures/printer-info.md)
**Deprecated:** Should use the new [`contents.getPrintersAsync`](web-contents.md#contentsgetprintersasync) API.
#### `contents.getPrintersAsync()`
Get the system printer list.
Returns `Promise<PrinterInfo[]>` - Resolves with a [`PrinterInfo[]`](structures/printer-info.md)
#### `contents.print([options], [callback])`
* `options` Object (optional)