• Robert Knight's avatar
    Make logic for waiting for PDFs to load work in PDF.js >= 2.5.207 · 77d30231
    Robert Knight authored
    f96af43d added support for PDF.js >= v2.5.207 by changing an event
    listener to use PDF.js's internal event bus rather than DOM events.
    However there was another DOM event listener for the `pagesloaded` event
    in `src/annotator/anchoring/pdf.js` that should also have been updated but was
    overlooked. This didn't cause a problem in testing with the dev server because
    the test documents load quickly enough that they are already loaded by the time
    the client's anchoring logic ran.
    
    This commit updates the way that the client listens for events from
    PDF.js to use the event bus where available and only fall back to the
    DOM in versions of PDF.js that don't support it.
    
     - Use PDF.js's event bus to listen for `documentload`/`documentloaded`
       and `pagesloaded` events
    
     - Add a fallback method to wait for event bus to become available in
       versions of PDF.js which support the eventBus but don't have the
       `initializedPromise` API
    
     - Improve the documentation around which versions of PDF.js support
       different event types and event dispatch methods
    
     - Add tests to cover the behavior from different releases of PDF.js
    
    For an overview of the different versions of PDF.js that the client
    needs to support, see https://github.com/hypothesis/client/issues/2643.
    77d30231
Name
Last commit
Last update
.github Loading commit data...
bin Loading commit data...
dev-server Loading commit data...
docs Loading commit data...
embedding-examples Loading commit data...
images Loading commit data...
scripts Loading commit data...
src Loading commit data...
.babelrc Loading commit data...
.dockerignore Loading commit data...
.eslintignore Loading commit data...
.eslintrc Loading commit data...
.gitignore Loading commit data...
.npmignore Loading commit data...
.npmrc Loading commit data...
.prettierignore Loading commit data...
.prettierrc Loading commit data...
.python-version Loading commit data...
CODE_OF_CONDUCT Loading commit data...
Dockerfile Loading commit data...
Jenkinsfile Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
codecov.yml Loading commit data...
gulpfile.js Loading commit data...
package.json Loading commit data...
requirements-dev.in Loading commit data...
tox.ini Loading commit data...
yarn.lock Loading commit data...