Skip to content

Commit

Permalink
custom fetch: always use if defined (#86)
Browse files Browse the repository at this point in the history
* custom fetch: if custom fetch is a function, always use it (to support simpler cdp bindings instead of puppeteer specific return behavior)
bump to 0.7.1
  • Loading branch information
ikreymer authored Feb 21, 2025
1 parent 43b967d commit 7fb29fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/behaviors.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browsertrix-behaviors",
"version": "0.7.0",
"version": "0.7.1",
"main": "index.js",
"author": "Webrecorder Software",
"license": "AGPL-3.0-or-later",
Expand Down
10 changes: 3 additions & 7 deletions src/autofetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,9 @@ export class AutoFetcher extends BackgroundBehavior {

this.numPending++;

let success = false;

if ((self as any).__bx_fetch) {
success = await (self as any).__bx_fetch(url);
}

if (!success) {
if (typeof((self as any).__bx_fetch) === "function") {
await (self as any).__bx_fetch(url);
} else {
await this.doFetchNonCors(url);
}

Expand Down

0 comments on commit 7fb29fe

Please sign in to comment.