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

Improve performance #10

Closed
wants to merge 1 commit into from
Closed

Improve performance #10

wants to merge 1 commit into from

Conversation

aminya
Copy link

@aminya aminya commented Nov 7, 2021

Fixes #9

  • Removes console log
  • Uses built-in use-strict feature of the browser
  • Fixes Eslint issues

Copy link
Owner

@ZimbiX ZimbiX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing, but I'm sorry, I don't think this is an improvement.

I don't like the formatting changes, and if anything, I'd be configuring eslint to prefer my style.

In future, please include more explanation and use smaller commits.

@@ -11,122 +11,108 @@
// @grant none
// ==/UserScript==

(function() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd thought enclosing the whole thing in a function was important to stop the scope leaking out, but I could be wrong there. Tampermonkey includes it in the template for a new script.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tampermonkey uses a very old template. In any browser used today, there is no need to use IEEE functions.


const playerIsFullscreen = () => {
const player = document.querySelector('ytd-player')
debugPlayerSize(player)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without any explanation as to how performance is improved, I assume you mean it's by not having to log the player size debugging? I never noticed an impact. And it'd be helpful information to supply when reporting an issue, so I'd like to leave it in. If you're concerned about it, a more useful change would be to make it toggleable via config.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log is useful when you are actively debugging the code. I don't think it is useful to print information and fill the dev console from these messages.


const isWatchVideoPage = () => window.location.pathname == "/watch"
const isWatchVideoPage = () => window.location.pathname === "/watch"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the necessity for all the triple equals?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=== means that the type of the left-hand side is the same as the type of the right-hand side.

@ZimbiX ZimbiX closed this Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove console.log in the production code
2 participants