Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a PDFViewerApplication.initializedPromise property to allow (easier) tracking of when the default viewer has been initialized #11607

Merged
merged 1 commit into from
Feb 18, 2020

Commits on Feb 17, 2020

  1. Add a PDFViewerApplication.initializedPromise property to allow (ea…

    …sier) tracking of when the default viewer has been initialized
    
    This complements the existing `PDFViewerApplication.initialized` boolean property, and may be helpful for custom implementations of the default viewer. This will thus provide users of the default viewer an alternative to setting the preference to dispatch events to the DOM (and listen for the "localized" event), since they can instead use:
    ```javascript
    document.addEventListener("webviewerloaded", function() {
      PDFViewerApplication.initializedPromise.then(function() {
        // The viewer has now been initialized.
      })
    });
    ```
    
    Note that in order to avoid manually tracking the initialization state *twice*, this implementation purposely uses the `PromiseCapability` functionality to handle both `PDFViewerApplication.initialized` and `PDFViewerApplication.initializedPromise` internally.
    Snuffleupagus committed Feb 17, 2020
    Configuration menu
    Copy the full SHA
    44587f3 View commit details
    Browse the repository at this point in the history