Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Conversation

Treora
Copy link
Contributor

@Treora Treora commented Nov 23, 2022

We have discussed similar APIs before, to make the common use cases easier.

  • createAnySelectorMatcher mimics the signature of existing matcher creators, but works on any selector type we support. For tools that try to maximise interoperability, matching a selector of any supported type should be easy; checking the type and using the right matcher is a task we can do for the user.

  • matchSelector wraps the this to make the common use case easy, hiding the generator and returning an array instead. Until they get advanced needs, a user should not have to care about async generators and curried functions to anchor a selector. Especially so as our highlighter messes up the matcher when used before the latter is finished (see issue TextQuoteSelector selector yielding an infinite number of matches #112).

Note this code depends on (and already includes the commits of) #136 and #137.

When trying to run yarn start, I get an error about missing imports, so probably I messed something up still..

Types & utility functions for annotations as a whole.

With code imported from <https://code.treora.com/gerben/web-annotation-utils>.
- createAnySelectorMatcher mimics the signature of existing matcher creators.
- matchSelector makes the common use case easy.
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant