refactor: replace function() callbacks with arrow functions#135
Conversation
5382bd2 to
886074d
Compare
robertodauria
left a comment
There was a problem hiding this comment.
LGTM.
Noting that this is a PR based on top of another PR which is being actively working on by two contributors (namely, me and @bassosimone). While the changes here are good, the pattern of making changes based on other contributors' PRs without prior coordination is less than ideal, causes effort duplication, and I recommend avoiding that in the future.
On a broader note: we've been receiving a large volume of unsolicited, sometimes AI-generated PRs with no prior discussion or contact, and as a small team this is not sustainable. We are updating our contribution requirements. Going forward, please coordinate with a maintainer before opening PRs or issues. See https://github.com/m-lab/gsoc#2-engage-with-us for details.
The runNdt7(), runMSAK(), and runPT() methods use const self = this to capture context for nested function() callbacks. This pattern is fragile and unclear, as noted in review. This PR replaces all function() callbacks with ES6 arrow functions, which lexically bind this from the enclosing SpeedTest object. This eliminates all three const self = this assignments and every self.* reference, making the code more concise and idiomatic.