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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downsizing JavaScript #15280

Merged
merged 2 commits into from
Apr 3, 2022
Merged

Conversation

schlimmchen
Copy link

Description:

Using lambdas (arrow functions) and using scientific notation for large integers we can save 58 Bytes of JavaScript code.

Not sure it is really worth a lot, but for fun I provide this PR 馃槈

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • The code change is tested and works with Tasmota core ESP32 V.2.0.3
  • I accept the CLA.

replacing anonymous functions by arrow functions saves 40 Bytes of
JavaScript code.
99999999 and 1e8 are not the same number, but srollTop only needs to be
very large, not that particular number.

saves 18 Bytes of JavaScript code.
@arendst
Copy link
Owner

arendst commented Apr 3, 2022

Thx.

I just remembered these lambda functions failed on IE and I even have a define for them: USE_JAVASCRIPT_ES6

I see it's disabled in my_user_config.h so the latest PR will only work on non-IE browsers. Not a big deal as IE is phased out anyway.

For now thx for the effort. I need to decide if I want to go all-in on lambda functions.

@s-hadinger
Copy link
Collaborator

I love it. Nice work.

I don't think it's a big deal to lose IE compatibility.

@Jason2866
Copy link
Collaborator

100% agree to drop IE support. Microsoft has done too.

@arendst arendst merged commit b14bb16 into arendst:development Apr 3, 2022
@schlimmchen schlimmchen deleted the downsizing-javascript branch April 3, 2022 12:50
arendst added a commit that referenced this pull request Apr 3, 2022
Remove support for Internet Explorer by allowing ECMAScript6 syntax using less JavaScript code bytes (#15280)
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.

None yet

4 participants