@letsscrapedata/controller 0.0.18 → 0.0.19
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.
- package/dist/index.cjs +8 -3
- package/dist/index.js +8 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -329,6 +329,7 @@ var PlaywrightPage = class extends import_node_events.default {
|
|
|
329
329
|
#resquestInterceptionOptions;
|
|
330
330
|
#responseInterceptionOptions;
|
|
331
331
|
#client;
|
|
332
|
+
#responseCb;
|
|
332
333
|
#hasValidUrl(page) {
|
|
333
334
|
const url = page.url();
|
|
334
335
|
return url.toLowerCase().startsWith("http");
|
|
@@ -541,6 +542,7 @@ var PlaywrightPage = class extends import_node_events.default {
|
|
|
541
542
|
this.#resquestInterceptionOptions = [];
|
|
542
543
|
this.#responseInterceptionOptions = [];
|
|
543
544
|
this.#client = null;
|
|
545
|
+
this.#responseCb = null;
|
|
544
546
|
this.#addPageOn();
|
|
545
547
|
}
|
|
546
548
|
async bringToFront() {
|
|
@@ -578,7 +580,9 @@ var PlaywrightPage = class extends import_node_events.default {
|
|
|
578
580
|
}
|
|
579
581
|
try {
|
|
580
582
|
if (this.#responseInterceptionOptions.length > 0) {
|
|
581
|
-
|
|
583
|
+
if (this.#responseCb) {
|
|
584
|
+
this.#page.removeListener("response", this.#responseCb);
|
|
585
|
+
}
|
|
582
586
|
this.#responseInterceptionOptions = [];
|
|
583
587
|
}
|
|
584
588
|
return true;
|
|
@@ -941,7 +945,7 @@ var PlaywrightPage = class extends import_node_events.default {
|
|
|
941
945
|
}
|
|
942
946
|
return true;
|
|
943
947
|
}
|
|
944
|
-
async #
|
|
948
|
+
async #responseListener(response) {
|
|
945
949
|
try {
|
|
946
950
|
const pageUrl = this.#page ? this.#page.url() : "";
|
|
947
951
|
if (!response.ok()) {
|
|
@@ -1008,7 +1012,8 @@ var PlaywrightPage = class extends import_node_events.default {
|
|
|
1008
1012
|
}
|
|
1009
1013
|
}
|
|
1010
1014
|
if (firstResponseInterception && this.#responseInterceptionOptions.length > 0) {
|
|
1011
|
-
this.#
|
|
1015
|
+
this.#responseCb = this.#responseListener.bind(this);
|
|
1016
|
+
this.#page.on("response", this.#responseCb);
|
|
1012
1017
|
}
|
|
1013
1018
|
return true;
|
|
1014
1019
|
}
|
package/dist/index.js
CHANGED
|
@@ -309,6 +309,7 @@ var PlaywrightPage = class extends EventEmitter {
|
|
|
309
309
|
#resquestInterceptionOptions;
|
|
310
310
|
#responseInterceptionOptions;
|
|
311
311
|
#client;
|
|
312
|
+
#responseCb;
|
|
312
313
|
#hasValidUrl(page) {
|
|
313
314
|
const url = page.url();
|
|
314
315
|
return url.toLowerCase().startsWith("http");
|
|
@@ -521,6 +522,7 @@ var PlaywrightPage = class extends EventEmitter {
|
|
|
521
522
|
this.#resquestInterceptionOptions = [];
|
|
522
523
|
this.#responseInterceptionOptions = [];
|
|
523
524
|
this.#client = null;
|
|
525
|
+
this.#responseCb = null;
|
|
524
526
|
this.#addPageOn();
|
|
525
527
|
}
|
|
526
528
|
async bringToFront() {
|
|
@@ -558,7 +560,9 @@ var PlaywrightPage = class extends EventEmitter {
|
|
|
558
560
|
}
|
|
559
561
|
try {
|
|
560
562
|
if (this.#responseInterceptionOptions.length > 0) {
|
|
561
|
-
|
|
563
|
+
if (this.#responseCb) {
|
|
564
|
+
this.#page.removeListener("response", this.#responseCb);
|
|
565
|
+
}
|
|
562
566
|
this.#responseInterceptionOptions = [];
|
|
563
567
|
}
|
|
564
568
|
return true;
|
|
@@ -921,7 +925,7 @@ var PlaywrightPage = class extends EventEmitter {
|
|
|
921
925
|
}
|
|
922
926
|
return true;
|
|
923
927
|
}
|
|
924
|
-
async #
|
|
928
|
+
async #responseListener(response) {
|
|
925
929
|
try {
|
|
926
930
|
const pageUrl = this.#page ? this.#page.url() : "";
|
|
927
931
|
if (!response.ok()) {
|
|
@@ -988,7 +992,8 @@ var PlaywrightPage = class extends EventEmitter {
|
|
|
988
992
|
}
|
|
989
993
|
}
|
|
990
994
|
if (firstResponseInterception && this.#responseInterceptionOptions.length > 0) {
|
|
991
|
-
this.#
|
|
995
|
+
this.#responseCb = this.#responseListener.bind(this);
|
|
996
|
+
this.#page.on("response", this.#responseCb);
|
|
992
997
|
}
|
|
993
998
|
return true;
|
|
994
999
|
}
|
package/package.json
CHANGED