By default, comimi uses IndexedDB to automatically persist global settings (locale, theme, etc.), manga-specific settings (pageTurnMode, hasCover, readingDirection), current layout mode, and the current page per manga.id.
To prevent persistence, set storage.enabled to false. To change the database name, use storage.databaseName (defaults to manga-viewer).
Handling initialPageIndex
- If
initialPageIndex is NOT provided: The viewer resumes from the last saved position in IndexedDB. If no position is saved, it starts at page 0. - If
initialPageIndex IS provided (including 0): The viewer opens at that specific page and does NOT restore the saved position. However, moving pages will continue to update the saved position for next time.
Overriding saved settings with forceSettings
Normally, settings act as a seed (used only if no saved value exists). To force specific settings to always use the provided values regardless of what is in IndexedDB, list their keys in the forceSettings array.
createMangaViewer(container, {
manga,
settings: {
readingDirection: "ltr", // This value is forced
backgroundColor: "black" // This is a seed; if a saved value exists, it wins
},
forceSettings: ["readingDirection"] // Only this key ignores the saved value
});