Skip to content

Tankōbon / preload / LibraryApi

Interface: LibraryApi ​

Defined in: preload.ts:74

The library and its per-entry fields, as window.tankobon.library.

Methods ​

addFile() ​

addFile(): Promise<AddFileResult>

Defined in: preload.ts:78

Opens a native file picker, then adds the chosen comic to the library without opening it; an unreadable file resolves to an error result rather than rejecting. The library organization then moves it, or offers to (organization).

Returns ​

Promise<AddFileResult>


addFolder() ​

addFolder(): Promise<ScanResult>

Defined in: preload.ts:80

Opens a native directory picker, then adds every comic found under it, recursively. The library organization then moves them, or offers to (organization).

Returns ​

Promise<ScanResult>


countUnorganized() ​

countUnorganized(): Promise<UnorganizedCountResult>

Defined in: preload.ts:86

How many library comics aren't in their place in the organized folder yet; an error result when the organization is off or its folder unreachable.

Returns ​

Promise<UnorganizedCountResult>


imageScanStatus() ​

imageScanStatus(): Promise<ImageScanProgress>

Defined in: preload.ts:102

Where the background measure of the books' page sizes is now (it runs after an import, a resync or the first opening of a book); resolves with the state a window that loads late missed.

Returns ​

Promise<ImageScanProgress>


list() ​

list(): Promise<LibraryEntry[]>

Defined in: preload.ts:76

Every library entry, most recently opened first.

Returns ​

Promise<LibraryEntry[]>


listFolders() ​

listFolders(): Promise<string[]>

Defined in: preload.ts:90

The folders added with addFolder, which resync walks again, in the order they were added.

Returns ​

Promise<string[]>


listUnlinkedFolders() ​

listUnlinkedFolders(): Promise<UnlinkedFolder[]>

Defined in: preload.ts:94

The library folders that have no path on this machine yet (the library was made on another one): their comics are listed but their files can't be found until relinkFolder.

Returns ​

Promise<UnlinkedFolder[]>


onImageScanProgress() ​

onImageScanProgress(listener): () => void

Defined in: preload.ts:104

Subscribes to the progress of that background measure; returns the unsubscribe function.

Parameters ​

listener ​

(progress) => void

Returns ​

() => void


onScanProgress() ​

onScanProgress(listener): () => void

Defined in: preload.ts:100

Subscribes to the progress of addFolder, resync and organizeAll; returns the unsubscribe function.

Parameters ​

listener ​

(progress) => void

Returns ​

() => void


organize() ​

organize(token): Promise<OrganizeResult>

Defined in: preload.ts:84

Moves into the organized folder the comics an addition offered to move (organization.pending.token of its result), each into its own subfolder; a token works once.

Parameters ​

token ​

string

Returns ​

Promise<OrganizeResult>


organizeAll() ​

organizeAll(): Promise<OrganizeResult>

Defined in: preload.ts:88

Moves every library comic not in its place yet into the organized folder (its own subfolder each), whenever it was added. Reports through onScanProgress; an error result when the organization is off, its folder unreachable, or a resynchronization or another organization is running.

Returns ​

Promise<OrganizeResult>


pickOrganizationFolder() ​

pickOrganizationFolder(): Promise<PickOrganizationFolderResult>

Defined in: preload.ts:82

Opens a native directory picker and makes the chosen folder the library organization's folder (the libraryOrganizationFolder setting, which settings.set refuses), also remembered among the folders resync walks.

Returns ​

Promise<PickOrganizationFolderResult>


relinkFolder() ​

relinkFolder(id): Promise<RelinkFolderResult>

Defined in: preload.ts:96

Opens a native directory picker to say where an unlinked folder (an id returned by listUnlinkedFolders) is on this machine; the comics stored relative to it are found again.

Parameters ​

id ​

string

Returns ​

Promise<RelinkFolderResult>


remove() ​

remove(id): Promise<void>

Defined in: preload.ts:106

Removes an entry from the library; the file on disk is left untouched.

Parameters ​

id ​

string

Returns ​

Promise<void>


removeFolder() ​

removeFolder(folder): Promise<void>

Defined in: preload.ts:92

Forgets one of those folders (a path returned by listFolders); its comics stay in the library.

Parameters ​

folder ​

string

Returns ​

Promise<void>


resync() ​

resync(): Promise<ResyncResult>

Defined in: preload.ts:98

Walks the remembered folders (and the organized folder, when the organization is on) again: new comics are added (then moved or offered by the organization, a comic dropped in the organized folder being moved into place), and comics whose file no longer exists are removed from the library (with their progress, rating, tags and reading-list places; the files on disk are never touched). A folder that can't be read is skipped and counted as unreachable. Stores the date as the lastResyncAt setting. Reports through onScanProgress; an error result when one is already running.

Returns ​

Promise<ResyncResult>


thumbnail() ​

thumbnail(id): Promise<Uint8Array<ArrayBuffer> | null>

Defined in: preload.ts:116

Cover thumbnail (first page, shrunk) of a library entry as WebP bytes, generated and cached first when missing; null if the entry is unknown or unreadable.

Parameters ​

id ​

string

Returns ​

Promise<Uint8Array<ArrayBuffer> | null>


updateMetadata() ​

updateMetadata(id, update): Promise<LibraryEntry | null>

Defined in: preload.ts:114

Writes the given metadata fields (title, series, credits…) of a library entry; resolves with the updated entry, or null if it is gone.

Parameters ​

id ​

string

update ​

MetadataUpdate

Returns ​

Promise<LibraryEntry | null>


updateProgress() ​

updateProgress(id, currentPage): Promise<void>

Defined in: preload.ts:108

Saves the last page read (0-based) of a library entry.

Parameters ​

id ​

string

currentPage ​

number

Returns ​

Promise<void>


updateRating() ​

updateRating(id, rating): Promise<void>

Defined in: preload.ts:110

Sets the rating of a library entry: 0 (unrated) to 5.

Parameters ​

id ​

string

rating ​

number

Returns ​

Promise<void>


updateTags() ​

updateTags(id, tags): Promise<void>

Defined in: preload.ts:112

Replaces the tags of a library entry.

Parameters ​

id ​

string

tags ​

string[]

Returns ​

Promise<void>