* Represents a Network object. * @constructor * @param {Driver} driver - The driver to fetch the BiDi connection. * @param {Array} browsingContextIds - An array of browsing context IDs that the network events will be subscribed to.
(driver, browsingContextIds)
| 49 | * @param {Array} browsingContextIds - An array of browsing context IDs that the network events will be subscribed to. |
| 50 | */ |
| 51 | constructor(driver, browsingContextIds) { |
| 52 | this._driver = driver |
| 53 | this._browsingContextIds = browsingContextIds |
| 54 | this.#listener = new Map() |
| 55 | this.#listener.set(NetworkEvent.AUTH_REQUIRED, new Map()) |
| 56 | this.#listener.set(NetworkEvent.BEFORE_REQUEST_SENT, new Map()) |
| 57 | this.#listener.set(NetworkEvent.FETCH_ERROR, new Map()) |
| 58 | this.#listener.set(NetworkEvent.RESPONSE_STARTED, new Map()) |
| 59 | this.#listener.set(NetworkEvent.RESPONSE_COMPLETED, new Map()) |
| 60 | } |
| 61 | |
| 62 | addCallback(eventType, callback) { |
| 63 | const id = ++this.#callbackId |