question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add events to the viewer API.

See original GitHub issue

Based on https://github.com/hypothesis/h/blob/document-pdfjs/docs/internals/pdfjs.rst:

  • Need an event when document loaded – documentloaded
  • Need an event when metadata is loaded – metadataloaded
  • Need an event when page is cleared (removed from the cache) – pageremoved

Also add state properties to indicate that those events were already triggered.

/cc @csillag

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:2
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
mollcommented, Jul 22, 2017

While there’s now an event bus, do I read the viewer code correctly when I say that there’s no way to know from the outside (e.g. an <iframe> referring to the viewer.html) when PDFViewerApplication itself has finished initializing? Before it finishes there’s no eventBus property to at all…

0reactions
Snuffleupaguscommented, Feb 23, 2019

Based on https://github.com/hypothesis/h/blob/document-pdfjs/docs/internals/pdfjs.rst:

That document is no longer available, and hence the use-cases for having the default viewer dispatch new events which are used nowhere in the code-base are difficult to justify at this point (in my opinion).

Need an event when document loaded – documentloaded

There’s already both documentinit and documentloaded events dispatched on the eventBus, representing when the document is ready for user-interaction respectively when the entire document has been loaded.

Need an event when metadata is loaded – metadataloaded

This seems like a fairly specialized use-case, and it could probably be achieved by simply waiting for the documentinit event and then manually access the metadata through e.g. the PDFViewerApplication.pdfDocument.getMetadata() method instead.

Need an event when page is cleared (removed from the cache) – pageremoved

There’s no real substitute for such an event (which based on the “removed from the cache” part probably ought to be placed in PDFPageView.destroy, if it were ever implemented).


Given the age of this issue, and that the use-cases might be “special”, should this be closed as WONTFIX at this point?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event Viewer API v1 - Akamai TechDocs
With the Event Viewer API, you can view a list of portal-visible events stored in the Event Logger system and related to a...
Read more >
Viewer API - Functions - Sketchfab
The Viewer API lets you build web apps on top of Sketchfab's 3D viewer. It provides functions for controlling the ... Adds a...
Read more >
Events Viewer - Visual Studio (Windows) - Microsoft Learn
The generic events viewer shows app activity through a list of events like module load, thread start, and system configuration.
Read more >
Events | Viewer | Autodesk Platform Services
Events are a mechanism to notify 3rd party code about changes in the Viewer. The Viewer actually listens to its own events in...
Read more >
Viewer events - Documentation - Dolby.io
In this new release we have added new events that can be received by the viewer application to detect: when a new source...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found