Skip to content

Commit

Permalink
perf: only make necessary API requests
Browse files Browse the repository at this point in the history
Eliminate a bunch of unnecessary XHR/fetch requests by filtering out all
but those to services.publix.com which are required to actually clip the
coupons.
  • Loading branch information
davecardwell committed Sep 13, 2020
1 parent 8bb93e3 commit 88d148f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,19 @@ function filterRequests(request: Request): void {
void request.continue();
break;

case "fetch":
case "other":
case "script":
case "xhr":
void request.continue();
break;

case "fetch":
case "xhr":
// Only need to make API requests
url.hostname === "services.publix.com"
? void request.continue()
: void request.abort();
break;

default:
void request.abort();
}
Expand Down

0 comments on commit 88d148f

Please sign in to comment.