Skip to content

Navigation and bookmarks

These functions move the reader through their history.

Moves the reader forward one step through their history. Does nothing if the reader is already at the latest step.

stepForward(): Promise<void>
Example
await stepForward();

Moves the reader back one step through their history, restoring the state from that step.

stepBack(): Promise<void>
Example
await stepBack();

Returns true if the reader is currently stepping backward through the story.

isRewinding(): boolean
Example
const rewinding = isRewinding();

A bookmark is a saved game. It captures the novel’s state so the reader can come back to it later.

Bookmarks save the state from the last committed beat. Any state changed after that isn’t included. See when to change state.

interface Bookmark {
id: string;
image: string;
time: number;
type: "auto" | "quick" | "user";
}
FieldDescription
idThe bookmark’s name.
imageA base64-encoded thumbnail image.
timeWhen the bookmark was saved.
typeWhether the bookmark was saved automatically, as a quicksave, or by the reader.

Returns every saved bookmark for the current novel.

getBookmarks(): Promise<Array<Bookmark>>
Example
const bookmarks = await getBookmarks();

Saves a bookmark with the state from the last committed beat.

saveBookmark(bookmark: Bookmark): Promise<void>
Example
await saveBookmark({
id: "Act III",
image: base64EncodedImage,
time: Date.now(),
type: "auto",
});

Loads a saved bookmark, restoring the novel to that point.

loadBookmark(bookmark: Bookmark): Promise<void>
Example
const bookmarks = await getBookmarks();
await loadBookmark(bookmarks[0]);