• Robert Knight's avatar
    Speed up PDF anchoring (#171) · ff8e000e
    Robert Knight authored
    When anchoring many annotations on a PDF, the text of the same page may
    be requested many times.
    
    The text is initially fetched via an async call to
    PDFViewerApplication.pdfViewer.getPageTextContent() and the result is
    then cached for future use.
    
    Previously the cache was only updated once this expensive call
    returned a result. Consequently when anchoring many annotations at once,
    there would be a lot of unnecessary cache misses and repeated calls to
    PDFViewerApplication.pdfViewer.getPageTextContent()
    
    Fix the problem by storing a promise for the result in the cache when
    the text for a given page is requested the first time. Consequently the
    text for each page will only be fetched once.
    ff8e000e
pdf.coffee 8.52 KB