ionic-epubjs icon indicating copy to clipboard operation
ionic-epubjs copied to clipboard

_updateTotalPages()

Open PaulHost opened this issue 7 years ago • 6 comments

Before _updateTotalPages() I can not do gotoPage(). book.generatePagination() method is very long, it may be possible to somehow skip it while saving it somewhere?

PaulHost avatar Oct 18 '17 11:10 PaulHost

What do you mean by "very long"? That it takes long to execute?

If I remember correctly, book.gotoPage() needs to have the book fully paginated, which happens via book.generatePagination().

You can check the epubjs code and repository if there might be a better way.

janpio avatar Oct 18 '17 11:10 janpio

yes, thank you!

PaulHost avatar Oct 18 '17 11:10 PaulHost

It can be implemented with the locations, but I don't understand how

PaulHost avatar Oct 18 '17 14:10 PaulHost

What does locations refer to here?

I am not fully in this project any more, so it would be great if you could search for the code here and post a link to the specific line - or some documentation.

janpio avatar Oct 18 '17 15:10 janpio

you use location only as event: https://github.com/janpio/ionic-epubjs/blob/db5aa52341e86b8991ae0a057d8bb8c64fbdf5cd/src/pages/book/book.ts#L44

this.book.on('book:pageChanged', (location) => { 
        console.log('on book:pageChanged', location);
        this._updateCurrentPage();
        this._updatePageTitle();
      });

it can somehow be used for quick opening from storage https://github.com/futurepress/epub.js/blob/86ba893a29e5fef57f79b8ec4ff94a869d327324/examples/locations.html#L184

PaulHost avatar Oct 19 '17 09:10 PaulHost

Thanks for the context.

So we listen to the book:pageChanged event which then gives a location parameter we can use and log.

I am not sure if we are using book.locations yet anywhere... the example there seems to be pretty new, right?

janpio avatar Oct 19 '17 10:10 janpio