fetch Timeline Range
Fetches an integer range containing a start and end position that most closely contains the specified locator. The returned range is defined as starting from the start
property and up-to but not including the end
property.
For example, if using WORDS as unit of measurement in a timeline of length 3 containing "The red fox" A locator pointing to the character 'x' in "fox" will return a the range 2-3 (i.e. matching one word "fox"). A locator range pointing to the content "ed fox" will return the range 1-3 (i.e. matching two words "red" "fox"). A locator pointing to the whitespace content " " between "red fox" will return the range 2-2 (i.e. matching no word, it starts at "fox" but ends before "fox").
If the location
does not target the ReaderPublication this timeline was created with, the returned Promise will be rejected.
If any of the ReaderDocuments targeted by the location
is not part of this timeline, the closest timeline position after that ReaderDocument will be used based on its index in the ReaderPublication spine. See fetchTimelinePosition() for an example.
Note that the returned IntegerRange object passed to onSuccess differs from the kotlin IntRange. The IntegerRange.end field is exclusive (i.e. maximum value + 1) while the IntRange.endInclusive field is inclusive.
Parameters
The locator to use when fetching the timeline range.
Called with the timeline range that most closely matches the locator.
Called if an error occurs when the operation is performed.
Fetches an integer range containing a start and end position that most closely contains the specified locator. The returned range is defined as starting from the start
property and up-to but not including the end
property.
For example, if using WORDS as unit of measurement in a timeline of length 3 containing "The red fox" A locator pointing to the character 'x' in "fox" will return a the range 2-3 (i.e. matching one word "fox"). A locator range pointing to the content "ed fox" will return the range 1-3 (i.e. matching two words "red" "fox"). A locator pointing to the whitespace content " " between "red fox" will return the range 2-2 (i.e. matching no word, it starts at "fox" but ends before "fox").
If the location
does not target the ReaderPublication this timeline was created with, the returned Promise will be rejected.
If any of the ReaderDocuments targeted by the location
is not part of this timeline, the closest timeline position after that ReaderDocument will be used based on its index in the ReaderPublication spine. See fetchTimelinePosition() for an example.
Note that the returned IntegerRange object passed to onSuccess differs from the kotlin IntRange. The IntegerRange.end field is exclusive (i.e. maximum value + 1) while the IntRange.endInclusive field is inclusive.
Return
Either ColibrioResult.Success containing the timeline range that most closely matches the locator, or ColibrioResult.Error containing the error.
Parameters
The locator to use when fetching the timeline range.