Options
All
  • Public
  • Public/Protected
  • All
Menu

Used for parsing different types of serialized selector data into Selector instances.

The SelectorFactory must be configured with SelectorDataParsers and FragmentSelectorParser in order to support different selector formats.

For example, to create a SelectorFactory that can parse EPUB CFI selectors, do the following

const selectorFactory = new SelectorFactory([
new EpubCfiFragmentSelectorParser()
])
const parsedEpubCfiSelector = selectorFactory.createFromFragment('epubcfi(/6/2!/4)');

If you have a serialized Locator you can use a LocatorFactory to parse it. You can use ReaderPublication.getLocatorFactory() to get a pre-configured LocatorFactory and SelectorFactory for that publication type.

Hierarchy

  • SelectorFactory

Implements

Index

Constructors

constructor

Methods

createFromFragment

  • Parses a fragment selector string into an ISelector instance. The types of selectors that can be parsed depends on which selector parser implementations this factory was created with.

    If the fragment selector format is unknown, an UnknownFragmentSelector instance is returned containing the fragment string.

    Parameters

    • fragment: string
    • Optional refinementSelectors: ISelector[]

    Returns ISelector

createFromSelectorData

  • createFromSelectorData(selectorData: unknown): ISelector[]

createRangeSelectors

getFragmentSelectorParsers

getSelectorDataParsers

Generated using TypeDoc