Add events to the viewer API.
See original GitHub issueBased 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:
- Created 9 years ago
- Reactions:2
- Comments:17 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 theviewer.html
) whenPDFViewerApplication
itself has finished initializing? Before it finishes there’s noeventBus
property to at all…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).
There’s already both
documentinit
anddocumentloaded
events dispatched on the eventBus, representing when the document is ready for user-interaction respectively when the entire document has been loaded.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. thePDFViewerApplication.pdfDocument.getMetadata()
method instead.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?