Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added conditional wrapper for only http & https #24

Merged
merged 3 commits into from
Mar 20, 2024

Conversation

mullojo
Copy link
Contributor

@mullojo mullojo commented Jun 13, 2021

Added this wrapper to the 'fetch' event listener

if (event.request.url.startsWith('http')){
  // only runs for http:// & https:// urls,  prevents error from running on chome-extention:// urls
}

Added this wrapper to the 'fetch' event listener
if (event.request.url.indexOf('http') === 0){
  // only runs for http:// & https:// urls,  prevents error from running on chome-extention:// urls
}
From a quick search, it seems that `startsWith` is the fastest approach.  Better than `indexOf` previously propoosed.
@ilan-schemoul
Copy link
Owner

Good PR but I feel like the console.log are not necessary. Could you remove it.

@ilan-schemoul
Copy link
Owner

I removed the console.log

@ilan-schemoul ilan-schemoul merged commit 3fa0a02 into ilan-schemoul:master Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants