IPC channels
Every channel between the renderer and the main process, from the *_CHANNELS constants in src/main/ipc/ and the window.tankobon API in src/preload.ts (whose type is TankobonApi).
| Channel | Direction | Preload API | Handler | Description |
|---|---|---|---|---|
achievements:list | renderer → main (invoke) | window.tankobon.achievements.list | ACHIEVEMENT_CHANNELS.list in src/main/ipc/achievements.ts | Every achievement earned so far, with the moment it was earned. |
achievements:unlock | renderer → main (invoke) | window.tankobon.achievements.unlock | ACHIEVEMENT_CHANNELS.unlock in src/main/ipc/achievements.ts | Records achievements as earned (the renderer evaluates the rules); ones already earned are left as they are, an unknown id is refused. Resolves with those that are new, which data:changed announces too. |
app:check-update | renderer → main (invoke) | window.tankobon.app.checkUpdate | APP_CHANNELS.checkUpdate in src/main/ipc/app.ts | Asks GitHub whether a release newer than the running version is published; a network failure comes back as an error result, not a rejection. |
app:get-info | renderer → main (invoke) | window.tankobon.app.getInfo | APP_CHANNELS.getInfo in src/main/ipc/app.ts | Versions of the app, Electron, Chromium, Node.js and V8, and the OS and CPU architecture. |
app:get-system-languages | renderer → main (invoke) | window.tankobon.app.getSystemLanguages | APP_CHANNELS.getSystemLanguages in src/main/ipc/app.ts | The OS's preferred languages (BCP 47 tags, most preferred first), to resolve the system language setting as the main process does. |
app:launch-file | main → renderer (push) | window.tankobon.app.onLaunchFile | APP_CHANNELS.launchFile in src/main/ipc/app.ts | Subscribes to the main process's app:launch-file push, sent when such a comic is waiting (call takeLaunchFile then); returns the unsubscribe function. |
app:open-link | renderer → main (invoke) | window.tankobon.app.openLink | APP_CHANNELS.openLink in src/main/ipc/app.ts | Opens one of the project's pages (repository, documentation…) in the default browser. |
app:take-launch-file | renderer → main (invoke) | window.tankobon.app.takeLaunchFile | APP_CHANNELS.takeLaunchFile in src/main/ipc/app.ts | The token of the comic the operating system asked to open (double click in the file explorer, "Open with…", a second launch with a file), or null; it is handed out once and opens like a comic.pickFile token. |
comic:close | renderer → main (invoke) | window.tankobon.comic.close | COMIC_CHANNELS.close in src/main/ipc/comic.ts | Closes a comic opened with open, releasing its archive in the main process. |
comic:open | renderer → main (invoke) | window.tankobon.comic.open | COMIC_CHANNELS.open in src/main/ipc/comic.ts | 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. |
comic:pick-file | renderer → main (invoke) | window.tankobon.comic.pickFile | COMIC_CHANNELS.pickFile in src/main/ipc/comic.ts | 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). |
comic:read-page | renderer → main (invoke) | window.tankobon.comic.readPage | COMIC_CHANNELS.readPage in src/main/ipc/comic.ts | Reads one page (0-based) of a comic opened with open, as image bytes. |
data:changed | main → renderer (push) | window.tankobon.data.onChanged | DATA_CHANGE_CHANNELS.changed in src/main/ipc/data-changes.ts | Subscribes to the main process's data:changed push, sent after every database write (library, reading lists, settings); returns the unsubscribe function. |
data:clear-library | renderer → main (invoke) | window.tankobon.data.clearLibrary | DATA_CHANNELS.clearLibrary in src/main/ipc/data.ts | Empties the library (entries, credits, people) and deletes every reading list and cover thumbnail; the comic files and the settings are left untouched. A failure comes back as an error result. |
data:export | renderer → main (invoke) | window.tankobon.data.export | DATA_CHANNELS.export in src/main/ipc/data.ts | Opens a native save dialog and writes a JSON export there; an error (full or read-only disk…) comes back as a result, not a rejection. |
data:import | renderer → main (invoke) | window.tankobon.data.import | DATA_CHANNELS.import in src/main/ipc/data.ts | Opens a native file picker and merges the chosen JSON export into the local database. |
database:choose-location | renderer → main (invoke) | window.tankobon.database.chooseLocation | DATABASE_CHANNELS.chooseLocation in src/main/ipc/database.ts | Opens a native directory picker; the new location only takes effect on the next start. |
database:get-location | renderer → main (invoke) | window.tankobon.database.getLocation | DATABASE_CHANNELS.getLocation in src/main/ipc/database.ts | Where the database file currently lives. |
database:relaunch | renderer → main (invoke) | window.tankobon.database.relaunch | DATABASE_CHANNELS.relaunch in src/main/ipc/database.ts | Restarts the app, e.g. to open the database from its new location. |
database:reset-location | renderer → main (invoke) | window.tankobon.database.resetLocation | DATABASE_CHANNELS.resetLocation in src/main/ipc/database.ts | Points the app back at the default location; takes effect on the next start. |
library:add-file | renderer → main (invoke) | window.tankobon.library.addFile | LIBRARY_CHANNELS.addFile in src/main/ipc/library.ts | 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). |
library:add-folder | renderer → main (invoke) | window.tankobon.library.addFolder | LIBRARY_CHANNELS.addFolder in src/main/ipc/library.ts | Opens a native directory picker, then adds every comic found under it, recursively. The library organization then moves them, or offers to (organization). |
library:count-unorganized | renderer → main (invoke) | window.tankobon.library.countUnorganized | LIBRARY_CHANNELS.countUnorganized in src/main/ipc/library.ts | 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. |
library:image-scan-progress | main → renderer (push) | window.tankobon.library.onImageScanProgress | LIBRARY_CHANNELS.imageScanProgress in src/main/ipc/library.ts | Subscribes to the progress of that background measure; returns the unsubscribe function. |
library:image-scan-status | renderer → main (invoke) | window.tankobon.library.imageScanStatus | LIBRARY_CHANNELS.imageScanStatus in src/main/ipc/library.ts | 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. |
library:list | renderer → main (invoke) | window.tankobon.library.list | LIBRARY_CHANNELS.list in src/main/ipc/library.ts | Every library entry, most recently opened first. |
library:list-folders | renderer → main (invoke) | window.tankobon.library.listFolders | LIBRARY_CHANNELS.listFolders in src/main/ipc/library.ts | The folders added with addFolder, which resync walks again, in the order they were added. |
library:list-unlinked-folders | renderer → main (invoke) | window.tankobon.library.listUnlinkedFolders | LIBRARY_CHANNELS.listUnlinkedFolders in src/main/ipc/library.ts | 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. |
library:organize | renderer → main (invoke) | window.tankobon.library.organize | LIBRARY_CHANNELS.organize in src/main/ipc/library.ts | 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. |
library:organize-all | renderer → main (invoke) | window.tankobon.library.organizeAll | LIBRARY_CHANNELS.organizeAll in src/main/ipc/library.ts | 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. |
library:pick-organization-folder | renderer → main (invoke) | window.tankobon.library.pickOrganizationFolder | LIBRARY_CHANNELS.pickOrganizationFolder in src/main/ipc/library.ts | 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. |
library:relink-folder | renderer → main (invoke) | window.tankobon.library.relinkFolder | LIBRARY_CHANNELS.relinkFolder in src/main/ipc/library.ts | 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. |
library:remove | renderer → main (invoke) | window.tankobon.library.remove | LIBRARY_CHANNELS.remove in src/main/ipc/library.ts | Removes an entry from the library; the file on disk is left untouched. |
library:remove-folder | renderer → main (invoke) | window.tankobon.library.removeFolder | LIBRARY_CHANNELS.removeFolder in src/main/ipc/library.ts | Forgets one of those folders (a path returned by listFolders); its comics stay in the library. |
library:resync | renderer → main (invoke) | window.tankobon.library.resync | LIBRARY_CHANNELS.resync in src/main/ipc/library.ts | 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. |
library:scan-progress | main → renderer (push) | window.tankobon.library.onScanProgress | LIBRARY_CHANNELS.scanProgress in src/main/ipc/library.ts | Subscribes to the progress of addFolder, resync and organizeAll; returns the unsubscribe function. |
library:thumbnail | renderer → main (invoke) | window.tankobon.library.thumbnail | LIBRARY_CHANNELS.thumbnail in src/main/ipc/library.ts | 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. |
library:update-metadata | renderer → main (invoke) | window.tankobon.library.updateMetadata | LIBRARY_CHANNELS.updateMetadata in src/main/ipc/library.ts | Writes the given metadata fields (title, series, credits…) of a library entry; resolves with the updated entry, or null if it is gone. |
library:update-progress | renderer → main (invoke) | window.tankobon.library.updateProgress | LIBRARY_CHANNELS.updateProgress in src/main/ipc/library.ts | Saves the last page read (0-based) of a library entry. |
library:update-rating | renderer → main (invoke) | window.tankobon.library.updateRating | LIBRARY_CHANNELS.updateRating in src/main/ipc/library.ts | Sets the rating of a library entry: 0 (unrated) to 5. |
library:update-tags | renderer → main (invoke) | window.tankobon.library.updateTags | LIBRARY_CHANNELS.updateTags in src/main/ipc/library.ts | Replaces the tags of a library entry. |
metadata:from-page | renderer → main (invoke) | window.tankobon.metadata.fromPage | METADATA_CHANNELS.fromPage in src/main/ipc/metadata.ts | Reads a book from the Bédéthèque album page at url, a link the user pasted. |
metadata:search | renderer → main (invoke) | window.tankobon.metadata.search | METADATA_CHANNELS.search in src/main/ipc/metadata.ts | Looks a book up in the public APIs enabled in the settings (Comic Vine, Google Books). |
reading-lists:add-entries | renderer → main (invoke) | window.tankobon.readingLists.addEntries | READING_LIST_CHANNELS.addEntries in src/main/ipc/reading-lists.ts | Appends several library entries to a reading list, in the order given: books already in it are skipped, and once it holds 50 books the rest are left out (the result counts each case). |
reading-lists:add-entry | renderer → main (invoke) | window.tankobon.readingLists.addEntry | READING_LIST_CHANNELS.addEntry in src/main/ipc/reading-lists.ts | Appends a library entry to a reading list; refused when the list already holds 50 books. |
reading-lists:create | renderer → main (invoke) | window.tankobon.readingLists.create | READING_LIST_CHANNELS.create in src/main/ipc/reading-lists.ts | Creates an empty reading list; refused when the name is empty. |
reading-lists:list | renderer → main (invoke) | window.tankobon.readingLists.list | READING_LIST_CHANNELS.list in src/main/ipc/reading-lists.ts | Every reading list, in the user's order (new lists last), each with its library entry ids in reading order. |
reading-lists:remove | renderer → main (invoke) | window.tankobon.readingLists.remove | READING_LIST_CHANNELS.remove in src/main/ipc/reading-lists.ts | Deletes a reading list; its books stay in the library. |
reading-lists:remove-entry | renderer → main (invoke) | window.tankobon.readingLists.removeEntry | READING_LIST_CHANNELS.removeEntry in src/main/ipc/reading-lists.ts | Takes a library entry out of a reading list. |
reading-lists:rename | renderer → main (invoke) | window.tankobon.readingLists.rename | READING_LIST_CHANNELS.rename in src/main/ipc/reading-lists.ts | Renames a reading list; refused when the name is empty. |
reading-lists:reorder | renderer → main (invoke) | window.tankobon.readingLists.reorder | READING_LIST_CHANNELS.reorder in src/main/ipc/reading-lists.ts | Stores a new order for a reading list; entryIds must hold exactly the list's current entries. |
reading-lists:reorder-lists | renderer → main (invoke) | window.tankobon.readingLists.reorderLists | READING_LIST_CHANNELS.reorderLists in src/main/ipc/reading-lists.ts | Stores a new order for the reading lists themselves; listIds must hold exactly the current lists. |
settings:get-all | renderer → main (invoke) | window.tankobon.settings.getAll | SETTINGS_CHANNELS.getAll in src/main/ipc/settings.ts | Every setting except the API keys, with defaults for the ones never stored. |
settings:get-api-keys | renderer → main (invoke) | window.tankobon.settings.getApiKeys | SETTINGS_CHANNELS.getApiKeys in src/main/ipc/settings.ts | The metadata sources' API keys, kept out of getAll() so only the page that edits them loads them. |
settings:set | renderer → main (invoke) | window.tankobon.settings.set | SETTINGS_CHANNELS.set in src/main/ipc/settings.ts | Stores one setting; the main process refuses an unknown key or a value its validator rejects. |
stats:add-reading-time | renderer → main (invoke) | window.tankobon.stats.addReadingTime | STATS_CHANNELS.addReadingTime in src/main/ipc/stats.ts | Adds seconds (1 to 3600) of reading time on a library entry to today; the reader reports it every few minutes while a book is open. |
stats:clear-history | renderer → main (invoke) | window.tankobon.stats.clearHistory | STATS_CHANNELS.clearHistory in src/main/ipc/stats.ts | Deletes the active user's reading history (the time spent per book and day, hence the statistics' reading time too); books, progress and completion dates are kept. |
stats:get | renderer → main (invoke) | window.tankobon.stats.get | STATS_CHANNELS.get in src/main/ipc/stats.ts | The reading history: the dates at which books were finished and the reading time per day, oldest first. |
stats:history | renderer → main (invoke) | window.tankobon.stats.history | STATS_CHANNELS.history in src/main/ipc/stats.ts | The active user's reading history for the profile page: reading time per day and book, most recent first, at most 200 lines. |
users:create | renderer → main (invoke) | window.tankobon.users.create | USER_CHANNELS.create in src/main/ipc/users.ts | Adds a user (nickname trimmed, not empty, unique ignoring case) with the default picture; it doesn't switch to them. |
users:list | renderer → main (invoke) | window.tankobon.users.list | USER_CHANNELS.list in src/main/ipc/users.ts | Every user and the active one's id. |
users:pick-avatar | renderer → main (invoke) | window.tankobon.users.pickAvatar | USER_CHANNELS.pickAvatar in src/main/ipc/users.ts | Opens a native picker for the active user's picture and returns the picked file's bytes (a PNG, JPEG or WebP), for the renderer to shrink before setAvatar(). |
users:remove | renderer → main (invoke) | window.tankobon.users.remove | USER_CHANNELS.remove in src/main/ipc/users.ts | Deletes the active user and all their personal data (progress, ratings, tags, lists, statistics, achievements, settings); the library is untouched. Refused for the last remaining user. On success the result is the user the app switched to. |
users:remove-avatar | renderer → main (invoke) | window.tankobon.users.removeAvatar | USER_CHANNELS.removeAvatar in src/main/ipc/users.ts | Puts the active user's default picture back. |
users:rename | renderer → main (invoke) | window.tankobon.users.rename | USER_CHANNELS.rename in src/main/ipc/users.ts | Changes the active user's nickname. |
users:set-avatar | renderer → main (invoke) | window.tankobon.users.setAvatar | USER_CHANNELS.setAvatar in src/main/ipc/users.ts | Stores the active user's picture (PNG, JPEG or WebP of at most 256 KiB). |
users:switch | renderer → main (invoke) | window.tankobon.users.switch | USER_CHANNELS.switch in src/main/ipc/users.ts | Makes another user the active one: everything personal, and the interface language, follow. data:changed announces it to every window. |