(pages: Page[])
| 154 | } |
| 155 | |
| 156 | async init(pages: Page[]) { |
| 157 | try { |
| 158 | await this.#mutex.acquire(); |
| 159 | const promises = []; |
| 160 | for (const page of pages) { |
| 161 | promises.push( |
| 162 | this.#createUniverseFor(page).then(targetUniverse => |
| 163 | this.#universes.set(page, targetUniverse), |
| 164 | ), |
| 165 | ); |
| 166 | } |
| 167 | |
| 168 | this.#browser.on('targetcreated', this.#onTargetCreated); |
| 169 | this.#browser.on('targetdestroyed', this.#onTargetDestroyed); |
| 170 | |
| 171 | await Promise.all(promises); |
| 172 | } finally { |
| 173 | this.#mutex.release(); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | get(page: Page): TargetUniverse | null { |
| 178 | return this.#universes.get(page) ?? null; |
no test coverage detected