unprint 0.18.22 → 0.18.24

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 +9 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.18.22",
3
+ "version": "0.18.24",
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
@@ -1243,10 +1243,11 @@ async function closeAllBrowsers() {
1243
1243
 
1244
1244
  await Promise.all(closingClients.map(async (client) => client.browser.close()));
1245
1245
 
1246
- events.emit('browser', {
1247
- action: 'close',
1246
+ events.emit('browserClose', {
1248
1247
  keys: closingClients.map((client) => client.key),
1249
1248
  active: closingClients.reduce((acc, client) => acc + (client.active || 0), 0),
1249
+ retired: false,
1250
+ clients: clients.size,
1250
1251
  });
1251
1252
  }
1252
1253
 
@@ -1256,10 +1257,11 @@ async function closeBrowser(client, options) {
1256
1257
  // this browser won't be reused
1257
1258
  await client.browser.close();
1258
1259
 
1259
- events.emit('browser', {
1260
- action: 'close',
1260
+ events.emit('browserClose', {
1261
1261
  keys: [client.key],
1262
1262
  active: client.active,
1263
+ retired: !!client.retired,
1264
+ clients: clients.size,
1263
1265
  });
1264
1266
  }
1265
1267
  }
@@ -1324,10 +1326,11 @@ async function browserRequest(url, customOptions = {}) {
1324
1326
  return limiter.schedule(async () => {
1325
1327
  const client = await getBrowserInstance(options.client, options, agent instanceof undici.ProxyAgent);
1326
1328
 
1327
- events.emit('browser', {
1328
- action: 'open',
1329
+ events.emit('browserOpen', {
1329
1330
  keys: [client.key],
1330
1331
  active: client.active,
1332
+ retired: false,
1333
+ clients: clients.size,
1331
1334
  });
1332
1335
 
1333
1336
  client.active += 1;