fetch Timeline Position
Fetches a timeline position that most closely matches the specified locator. If locator
is a range, the start of the range will be used.
When fetching a timeline position for a locator that is before the timeline, 0 will be returned. When fetching a timeline position for a locator that is after the timeline, timeline.length
will be returned.
If the location
does not target the same ReaderPublication, the returned Promise will be rejected.
If the ReaderDocument targeted by the location
is not part of the timeline, the closest timeline position after that ReaderDocument will be used based on its index in the ReaderPublication spine.
For example: A ReaderPublication defines the spine of ReaderDocuments as [d0, d1, d2]
. A ContentPositionTimeline is created with [d0, d2]
. Fetching a timeline position for any location targeting ReaderDocument d1
will return the timeline position for the start of ReaderDocument d2
.
In text-based unit of measurements, like for example WORDS, a location pointing to in-between words will return the timeline position for the word closest after that location. For example, a locator pointing to the whitespace between the words "Great book" will return the timeline position for the word "book".
Parameters
The locator to use when fetching the timeline position.
Called with the timeline position that most closely matches the locator.
Called if an error occurs when the operation is performed.
Fetches a timeline position that most closely matches the specified locator. If locator
is a range, the start of the range will be used.
When fetching a timeline position for a locator that is before the timeline, 0 will be returned. When fetching a timeline position for a locator that is after the timeline, timeline.length
will be returned.
If the location
does not target the same ReaderPublication, the returned Promise will be rejected.
If the ReaderDocument targeted by the location
is not part of the timeline, the closest timeline position after that ReaderDocument will be used based on its index in the ReaderPublication spine.
For example: A ReaderPublication defines the spine of ReaderDocuments as [d0, d1, d2]
. A ContentPositionTimeline is created with [d0, d2]
. Fetching a timeline position for any location targeting ReaderDocument d1
will return the timeline position for the start of ReaderDocument d2
.
In text-based unit of measurements, like for example WORDS, a location pointing to in-between words will return the timeline position for the word closest after that location. For example, a locator pointing to the whitespace between the words "Great book" will return the timeline position for the word "book".
Return
Either ColibrioResult.Success containing the timeline position that most closely matches the locator, or ColibrioResult.Error containing the error.
Parameters
The locator to use when fetching the timeline position.