2020 ```
2121 pnpm install puppeteer @hoplin/puppeteer-pool
2222 ```
23- <details >
24- <summary ><b >Patch Note</b ></summary >
25- <div markdown =" 1 " >
2623
27- ### Release 2.0.8
24+ ## Release 2.0.8(and it's sub versions)
25+
26+ - ` PuppeteerPool.start ` required parameter as config type
27+
28+ ``` typescript
29+ type PuppeteerPoolStartOptions = {
30+ /**
31+ * Number of concurrency,
32+ * Default is 3
33+ */
34+ concurrencyLevel: number ;
35+ /**
36+ * Context mode
37+ * Default is ContextMode.SHARED
38+ */
39+ contextMode: ContextMode ;
40+ /**
41+ * Puppeteer launch options
42+ * Default is {}
43+ */
44+ options? : puppeteer .LaunchOptions ;
45+ /**
46+ * Custom config path
47+ */
48+ customConfigPath? : string ;
49+ /**
50+ * Enable log
51+ * Default is true
52+ */
53+ enableLog? : boolean ;
54+ /**
55+ * Log level
56+ * Default is LogLevel.DEBUG
57+ */
58+ logLevel? : LogLevel ;
59+ };
60+ ```
2861
2962- Remove pino logger dependency and implement custom logger
3063 - You can config ` log level ` and ` enable log ` in ` PuppeteerPool.start ` function
3164- Enhanced Concurrency Control
3265
33- ### Next Features in 2.0.9
66+ ## Next Features in 2.0.9
3467
3568- Detailed Metrics Monitoring
3669 - Monitor metrics by context
3770- Support to use Playwright instead of Puppeteer
3871
39- </div >
40- </details >
41-
4272## Fully changed from 2.0.0
4373
4474The internal implementation is event-based, which significantly improves the stability. In addition, instead of relying
@@ -58,32 +88,50 @@ After that you can use dispatcher to control pool manager.
5888- PuppeteePool
5989 - ` PuppeteerPool ` is singleton class. You can use ` PuppeteerPool.start ` to initialize pool manager.
6090- PuppeteerPool.start
91+
6192 - Static Method
6293 - Description: Initialize pool manager. You need to call this function to start puppeteer pool. Even if you invoke
6394 this function multiple times with differenct arguments, it will return the first initialized instance.
64- - Args
65- - concurrencyLevel
66- - Required
67- - number
68- - contextMode: ContextMode
69- - Required
70- - ` ContextMode.ISOLATED ` | ` ContextMode.SHARED `
71- - enableLog: boolean
72- - Optional
73- - Default: ` true `
74- - logLevel: LogLevel
75- - Optional
76- - Default: ` LogLevel.DEBUG `
77- - options
78- - Optional
79- - [ puppeteer.LaunchOptions] ( https://pptr.dev/api/puppeteer.launchoptions )
80- - Default: ` {} `
81- - customConfigPath
82- - Optional
83- - string (Default: ` puppeteer-pool-config.json ` in project root)
95+ - Args: ` PuppeteerPoolStartOptions `
96+
97+ ``` typescript
98+ type PuppeteerPoolStartOptions = {
99+ /**
100+ * Number of concurrency,
101+ * Default is 3
102+ */
103+ concurrencyLevel: number ;
104+ /**
105+ * Context mode
106+ * Default is ContextMode.SHARED
107+ */
108+ contextMode: ContextMode ;
109+ /**
110+ * Puppeteer launch options
111+ * Default is {}
112+ */
113+ options? : puppeteer .LaunchOptions ;
114+ /**
115+ * Custom config path
116+ */
117+ customConfigPath? : string ;
118+ /**
119+ * Enable log
120+ * Default is true
121+ */
122+ enableLog? : boolean ;
123+ /**
124+ * Log level
125+ * Default is LogLevel.DEBUG
126+ */
127+ logLevel? : LogLevel ;
128+ };
129+ ```
130+
84131 - Return
85132 - ` Promise<PuppeteerPool> `
86133 - Returns PuppeteerPool Instance .
134+
87135- Instance < PuppeteerPool > .stop
88136 - Description : Stop pool manager . It will close all sessions and terminate pool manager .
89137 - Return
@@ -114,7 +162,10 @@ After that you can use dispatcher to control pool manager.
114162import { ContextMode, PuppeteerPool } from '@hoplin/puppeteer-pool';
115163
116164async function main() {
117- const poolInstance = await PuppeteerPool.start(2, ContextMode.ISOLATED);
165+ const poolInstance = await PuppeteerPool.start({
166+ concurrencyLevel: 2,
167+ contextMode: ContextMode.ISOLATED,
168+ });
118169
119170 const urls = [
120171 'https://www.google.com',
0 commit comments