Skip to content

Tankōbon / preload / ComicApi

Interface: ComicApi ​

Defined in: preload.ts:57

Opening and reading comics, as window.tankobon.comic.

Methods ​

close() ​

close(id): Promise<void>

Defined in: preload.ts:70

Closes a comic opened with open, releasing its archive in the main process.

Parameters ​

id ​

string

Returns ​

Promise<void>


open() ​

open(ref): Promise<OpenComicResult>

Defined in: preload.ts:66

Opens a comic and registers it in the library (or refreshes its entry); resolves with its saved page. ref is a library entry id or a token from pickFile, never a path. A file that can't be opened (moved, deleted, corrupted, unsupported) resolves to an error result with a message in the interface language, rather than rejecting.

Parameters ​

ref ​

string

Returns ​

Promise<OpenComicResult>


pickFile() ​

pickFile(addToLibrary): Promise<string | null>

Defined in: preload.ts:61

Opens a native file picker; resolves to an opaque token for the chosen file (to pass to open), or null if cancelled. The renderer never learns the path. addToLibrary is true for the library's "add a file" (opening the token then always adds the book) and false for the reader's "open a file" (the book is added only if the addOpenedBooksToLibrary setting is on).

Parameters ​

addToLibrary ​

boolean

Returns ​

Promise<string | null>


readPage() ​

readPage(id, index): Promise<ComicPage>

Defined in: preload.ts:68

Reads one page (0-based) of a comic opened with open, as image bytes.

Parameters ​

id ​

string

index ​

number

Returns ​

Promise<ComicPage>