Closed Neulus closed 5 days ago
Nice job tracking it down.
I think a small change I would prefer is just setting the currentPercentage to 0 if the displayedCFI is not ready.
// wait until displayedCFI is loaded
const currentPercentage = displayedCFI ? renditionInstance?.book.locations.percentageFromCfi(displayedCFI):0
Ill merge this in and make the changes. Thanks!
When loading a
.txt
file, I observed thatpercentageFromCfi
is invoked withdisplayedCFI
beforedisplayedCFI
is fully initialized. This premature loading can cause issues similar to those reported in #47.Changes