futurepress / epub.js

Enhanced eBooks in the browser.
http://futurepress.org
Other
6.3k stars 1.08k forks source link

annotations.each() method error #1262

Open abramsohn opened 2 years ago

abramsohn commented 2 years ago

Hi, I am trying to use the annotation.each() method and I keep getting an error "Cannot read property 'apply' of undefined" It looks like the this method is trying to loop over rendition._annotations with a forEach, and that the _annotations is an object not an array.

http://epubjs.org/documentation/0.3/#annotations

victorsoares96 commented 3 months ago

use this trick for get annotations:

const annotations = Object.values(rendition.annotations._annotations);