Skip to content

Tankōbon / hooks/use-reading-pace / useReadingPace

Function: useReadingPace() ​

useReadingPace(sessionKey, pageCount, currentPage): ReadingPace

Defined in: hooks/use-reading-pace.ts:31

Tracks how fast the current page advances (pages per minute) since sessionKey last changed, and estimates the time left to reach the last page at that pace. sessionKey should be a value that changes exactly when a new book (or a new reading session for one) starts, e.g. the opened archive's id — that resets the pace tracking, following React's "adjust state while rendering" pattern rather than an effect, so the very first render already reflects the new session.

Parameters ​

sessionKey ​

string | undefined

pageCount ​

number

currentPage ​

number

Returns ​

ReadingPace