EpubReaderState

State holder for EpubReader. Wraps the core Navigator and exposes its current position as snapshot state so Compose recomposes on chapter changes.

Properties

Link copied to clipboard

Last #fragment requested by goto / gotoResource.

Link copied to clipboard

The chapter Resource currently displayed, or null if none. Changes recompose readers of this state.

Link copied to clipboard

Whether a next spine section exists to navigate to via next.

Link copied to clipboard

Whether a previous spine section exists to navigate to via previous.

Functions

Link copied to clipboard
fun goto(ref: TOCReference)

Navigates to the target of TOC entry ref, including its #fragment if present. No-op if ref has no resource.

Link copied to clipboard
fun gotoHref(href: String)

Navigates to the EPUB-relative href, which may include a #fragment.

Link copied to clipboard
fun gotoResource(resource: Resource, fragmentId: String? = null)

Navigate to resource, optionally scrolling to the named fragmentId within the chapter (the part after #).

Link copied to clipboard
fun next()

Advances to the next spine section. No-op if hasNext is false.

Link copied to clipboard
fun previous()

Goes back to the previous spine section. No-op if hasPrevious is false.