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

this pointer used incorrectly in forEach #11

Closed
sdetweil opened this issue Jun 6, 2020 · 1 comment
Closed

this pointer used incorrectly in forEach #11

sdetweil opened this issue Jun 6, 2020 · 1 comment

Comments

@sdetweil
Copy link

sdetweil commented Jun 6, 2020

in the forEach() (line 47 of MMM-Tado.js) loop thru the zone info, one of the this.config.units uses self (line 69) (set on line 32) , the rest (4) use this.config.units, (lines 98, 121, 161, and 190)

but... unless you specifically pass the second parm (after the function) in the forEach invocation 'this' is undefined inside the foreach , so the test fails, and the result is Fahrenheit display is selected

see 22.1.3.12 Array.prototype.forEach
https://tc39.es/ecma262/#sec-ecmascript-language-statements-and-declarations

the 4 statements should be changed to self.config.units

@WouterEekhout
Copy link
Owner

WouterEekhout commented Jun 6, 2020

@sdetweil Good find!

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

2 participants