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 deprecation warning for the eventBusDispatchToDOM option/preference (PR 11631 follow-up) #11667

Merged
merged 2 commits into from
Mar 6, 2020

Conversation

Snuffleupagus
Copy link
Collaborator

  • Update the waitOnEventOrTimeout helper function to handle internal events consistently with the rest of the viewer components (PR 11631 follow-up)

    I overlooked this in PR [api-minor] Deprecate getGlobalEventBus and update the "viewer components" examples accordingly #11631; sorry about that!

    Also, ensure that EventBus instances always track "external" events using a boolean regardless of the actual option value.

  • Move the dispatchDOMEvent functionality out from the EventBus and add a deprecation warning for the eventBusDispatchToDOM option/preference (PR 11631 follow-up)

    It occured to me that similar to the getGlobalEventBus function, it's probably a good idea to also notify users of the fact that eventBusDispatchToDOM is now deprecated.

    Rather than depending of the re-dispatching of internal events to the DOM, the default viewer can instead be used in e.g. the following way:

    document.addEventListener("webviewerloaded", function() {
      PDFViewerApplication.initializedPromise.then(function() {
        // The viewer has now been initialized, and its properties can be accessed.
    
        PDFViewerApplication.eventBus.on("pagerendered", function(event) {
          console.log("Has rendered page number: " + event.pageNumber);
        });
      });
    });

…events consistently with the rest of the viewer components (PR 11631 follow-up)

I overlooked this in PR 11631; sorry about that!

Also, ensure that `EventBus` instances *always* track "external" events using a boolean regardless of the actual option value.
@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2020

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/e99c02281732aa2/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2020

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/8725df675a46a29/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2020

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/8725df675a46a29/output.txt

Total script time: 2.68 mins

  • Unit Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2020

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/e99c02281732aa2/output.txt

Total script time: 4.81 mins

  • Unit Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2020

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/de78f4b627ef22c/output.txt

@Snuffleupagus Snuffleupagus mentioned this pull request Mar 5, 2020
3 tasks
@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2020

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/de78f4b627ef22c/output.txt

Total script time: 2.53 mins

Published

… add a deprecation warning for the `eventBusDispatchToDOM` option/preference (PR 11631 follow-up)

It occured to me that similar to the `getGlobalEventBus` function, it's probably a good idea to *also* notify users of the fact that `eventBusDispatchToDOM` is now deprecated.

Rather than depending of the re-dispatching of internal events to the DOM, the default viewer can instead be used in e.g. the following way:
```javascript
document.addEventListener("webviewerloaded", function() {
  PDFViewerApplication.initializedPromise.then(function() {
    // The viewer has now been initialized, and its properties can be accessed.

    PDFViewerApplication.eventBus.on("pagerendered", function(event) {
      console.log("Has rendered page number: " + event.pageNumber);
    });
  });
});
```
@Snuffleupagus Snuffleupagus force-pushed the move-dispatchDOMEvent branch from 3e582ee to 0fb44f5 Compare March 5, 2020 12:27
@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2020

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/6d7528218f30866/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2020

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/6d7528218f30866/output.txt

Total script time: 2.54 mins

Published

@timvandermeij timvandermeij merged commit 001b0b2 into mozilla:master Mar 6, 2020
@timvandermeij
Copy link
Contributor

Yes, that's indeed a good idea. Thanks!

@Snuffleupagus Snuffleupagus deleted the move-dispatchDOMEvent branch March 6, 2020 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants