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

Add support for search parameters in named targets (?id=UUID) #57

Merged
merged 3 commits into from
Feb 5, 2022

Conversation

fregante
Copy link
Contributor

Probably the last piece for this issue, at least for extension pages:

Needs:

  • tests


// Soft warning: Race conditions are possible.
// This CANNOT be awaited because waiting for it means "I will handle the message."
// If a message is received before this is ready, it will just have to be ignored.
let thisTarget: AnyTarget | undefined;

function compareTargets(to: AnyTarget, thisTarget: AnyTarget): boolean {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into using URLPattern to compare the URLs, but unfortunately that API does not care for search parameters because it treats them as a plain string so only exact matches are possible.

This function instead will match the target a.html?id=1 even if the current page is a.html?something=else&id=1

@fregante fregante marked this pull request as ready for review February 5, 2022 15:51
@fregante fregante merged commit 3ddbbf2 into main Feb 5, 2022
@fregante fregante deleted the pages-with-params branch February 5, 2022 15:51
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.

1 participant