unprint 0.18.20 → 0.18.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/app.js +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.18.20",
3
+ "version": "0.18.22",
4
4
  "description": "Simplify common web scraping tasks while staying in control of the data.",
5
5
  "main": "src/app.js",
6
6
  "scripts": {},
package/src/app.js CHANGED
@@ -1239,7 +1239,15 @@ async function getBrowserInstance(scope, options, useProxy = false) {
1239
1239
  }
1240
1240
 
1241
1241
  async function closeAllBrowsers() {
1242
- await Promise.all(Array.from(clients.values()).map(async (client) => client.browser.close()));
1242
+ const closingClients = Array.from(clients.values());
1243
+
1244
+ await Promise.all(closingClients.map(async (client) => client.browser.close()));
1245
+
1246
+ events.emit('browser', {
1247
+ action: 'close',
1248
+ keys: closingClients.map((client) => client.key),
1249
+ active: closingClients.reduce((acc, client) => acc + (client.active || 0), 0),
1250
+ });
1243
1251
  }
1244
1252
 
1245
1253
  async function closeBrowser(client, options) {
@@ -1250,7 +1258,7 @@ async function closeBrowser(client, options) {
1250
1258
 
1251
1259
  events.emit('browser', {
1252
1260
  action: 'close',
1253
- key: client.key,
1261
+ keys: [client.key],
1254
1262
  active: client.active,
1255
1263
  });
1256
1264
  }
@@ -1318,7 +1326,7 @@ async function browserRequest(url, customOptions = {}) {
1318
1326
 
1319
1327
  events.emit('browser', {
1320
1328
  action: 'open',
1321
- key: client.key,
1329
+ keys: [client.key],
1322
1330
  active: client.active,
1323
1331
  });
1324
1332