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

Solve All this-Binding Problems #3

Open
1 of 3 tasks
zhzLuke96 opened this issue Feb 28, 2025 · 0 comments
Open
1 of 3 tasks

Solve All this-Binding Problems #3

zhzLuke96 opened this issue Feb 28, 2025 · 0 comments

Comments

@zhzLuke96
Copy link
Member

zhzLuke96 commented Feb 28, 2025

Currently, the code contains many instances of var that = this;

These likely originate from the forked repository, possibly due to an automated JS-to-TS conversion tool.

This can lead to various issues, the most significant being the silent loss of this, which is difficult to detect.

TODOs:

  • Remove all occurrences of var that = this; and replace them with arrow functions () => {} wherever applicable.
    • Scope: 13 files, 28 occurrences.
  • Address remaining instances of xx = this;
    • These might stem from syntax habits (e.g., var self = this;, which resembles Python-style code but is unnecessary in modern TypeScript).
    • Scope: 17 files, 55 occurrences.
  • More aggressively, eliminate all var xxx declarations.
    • var is legacy code and poses potential risks in every line where it appears.
    • Scope: 1182 occurrences. Replace to let them entirely is advisable.
@zhzLuke96 zhzLuke96 changed the title Solve all this-binding problems Solve All this-Binding Problems Feb 28, 2025
zhzLuke96 added a commit that referenced this issue Feb 28, 2025
- improve this binding
- fix widget typing
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

No branches or pull requests

1 participant