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:
parent
b936f5e14a
commit
8f51d3e1bf
5 changed files with 70 additions and 4 deletions
|
@ -1728,6 +1728,16 @@ describe('webContents module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
ifdescribe(features.isPrintingEnabled())('getPrintersAsync()', () => {
|
||||
afterEach(closeAllWindows);
|
||||
it('can get printer list', async () => {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { sandbox: true } });
|
||||
await w.loadURL('about:blank');
|
||||
const printers = await w.webContents.getPrintersAsync();
|
||||
expect(printers).to.be.an('array');
|
||||
});
|
||||
});
|
||||
|
||||
ifdescribe(features.isPrintingEnabled())('printToPDF()', () => {
|
||||
let w: BrowserWindow;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue