Timeline for How to access the correct `this` inside a callback
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 15, 2023 at 15:50 | comment | added | ejectamenta | I think you are free to edit the post and make it more terse, if it is still understandable and gives the same result on "run code snippet", then I have no problem with this. | |
May 12, 2023 at 11:36 | comment | added | Felix Kling |
But why would you present a solution that is more difficult to understand? Solutions should be reduced to the absolute minimum so that they are easy to understand. According to your argument I could provide the following solution to the question "how to add two numbers" and it would be ok? function mul(x, y) { return x * y; } function add(x, y) { return mul(x, 1) + mul(y, 1); }; add(41, 1)
|
|
May 11, 2023 at 18:33 | comment | added | ejectamenta | The question was about accessing 'this' in the context of the derived class, not what is the simplest way to call a function on the parent class. | |
May 10, 2023 at 15:53 | comment | added | Felix Kling |
This is unnecessarily complicated. At the very least you could write this.callback = function() { parent.callbackFunctionOfParent() } but I'm sure this could be simplified a lot more depending on what you are actually trying to achieve.
|
|
Mar 24, 2023 at 10:45 | history | answered | ejectamenta | CC BY-SA 4.0 |