Open PaulHost opened 6 years ago
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.
yes, thank you!
It can be implemented with the locations
, but I don't understand how
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.
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
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?
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?