Skip to content

Improve the larger event listeners in the web/app.js file#18544

Merged
timvandermeij merged 2 commits into
mozilla:masterfrom
Snuffleupagus:app-bind-listeners
Aug 2, 2024
Merged

Improve the larger event listeners in the web/app.js file#18544
timvandermeij merged 2 commits into
mozilla:masterfrom
Snuffleupagus:app-bind-listeners

Conversation

@Snuffleupagus

Copy link
Copy Markdown
Collaborator
  • Shorten the names of the event listeners.

  • Use bind to pass in the PDFViewerApplication-scope to the event handlers.
    This makes the event handler code (a lot) less verbose, and this change is possible now that we're removing event listeners with AbortSignal.

  • Move the GENERIC-only event listeners into the same pre-processor block.

Note: This patch reduces the size of the gulp mozcentral output by ~4.3 kilo-bytes, which isn't a lot but still cannot hurt.

 - Shorten the names of the event listeners.

 - Use `bind` to pass in the `PDFViewerApplication`-scope to the event handlers.
   This makes the event handler code (a lot) less verbose, and this change is possible now that we're removing event listeners with `AbortSignal`.

 - Move the GENERIC-only event listeners into the same pre-processor block.

*Note:* This patch reduces the size of the `gulp mozcentral` output by `~4.3` kilo-bytes, which isn't a lot but still cannot hurt.
…tion

Given that these event handlers are virtually identical, obviously with the exception of the name-parameter, let's reduce a little bit of code duplication.
Comment thread web/app.js
@Snuffleupagus

Copy link
Copy Markdown
Collaborator Author

/botio integrationtest

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/bf1a46b9d83c67b/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/cd727dab2792185/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/cd727dab2792185/output.txt

Total script time: 8.44 mins

  • Integration Tests: Passed

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/bf1a46b9d83c67b/output.txt

Total script time: 17.97 mins

  • Integration Tests: Passed

@Snuffleupagus Snuffleupagus marked this pull request as ready for review August 2, 2024 14:46
@timvandermeij

Copy link
Copy Markdown
Collaborator

/botio-linux preview

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 1

Live output at: http://54.241.84.105:8877/9e6cba4983e6928/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/9e6cba4983e6928/output.txt

Total script time: 1.04 mins

Published

timvandermeij
timvandermeij approved these changes Aug 2, 2024
@timvandermeij timvandermeij merged commit 7ac87dd into mozilla:master Aug 2, 2024
@timvandermeij

Copy link
Copy Markdown
Collaborator

Thank you for simplifying this!

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