Tankōbon / hooks/use-comic / useComic
Function: useComic()
useComic(
__namedParameters?):object
Defined in: hooks/use-comic.ts:39
Owns the currently opened comic: file picking, page loading, cleanup.
Parameters
__namedParameters?
UseComicOptions = {}
Returns
close
close: () =>
Promise<void>
Closes the current comic and resets the state.
Returns
Promise<void>
comic
comic:
ComicInfo|null
error
error:
string|null
goTo
goTo: (
page) =>void
Goes to a page (0-based), clamped to the comic's range.
Parameters
page
number
Returns
void
loading
loading:
boolean
next
next: () =>
void
Page index + 1, regardless of the reading direction.
Returns
void
openFile
openFile: (
ref) =>Promise<void>
Opens a comic at its saved page; on failure, sets error and keeps the previous comic.
Parameters
ref
string
Returns
Promise<void>
page
page:
number
pageKey
pageKey:
string|null
<archive id>:<page index> of the page pageUrl shows. page moves on before the new image has arrived, so it can't name the image on screen; this does. Null while there is none.
pageUrl
pageUrl:
string|null
Blob URL of the current page, null while loading.
pickAndOpen
pickAndOpen: () =>
Promise<void>
Shows the native file picker, then opens the chosen file (nothing happens if cancelled).
Returns
Promise<void>
prev
prev: () =>
void
Page index - 1, regardless of the reading direction.
Returns
void