Skip to content

How to to get epub current chapter? #1412

@pedrohubxp

Description

@pedrohubxp
Image
    renditionInstance.on('locationChanged', (location: Location) => {
      // @ts-expect-error - href is not typed
      const chapterHref = decodeURIComponent(location.href);
      console.log('chapterHref', chapterHref);
      const chapters = epubBook.navigation.toc;
      console.log('chapters', chapters);
    });

I'm trying to find the title of my epubjs with this code, that's what I saw on the internet but apparently it doesn't work anymore, do you have any idea how to get the current chapter?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions