the nested this.app won’t work, what can I do to make it work? I’m guessing the ‘this’ gets screwed up during nesting, but I don’t know how to fix it. I’ve tried my best to avoid this problem by using this.app without nesting, but now I really need to use it inside an event handler.
The this inside the anonymous function is not the same this outside it as they are in different scopes. The typical way of doing the above is to create a new variable within a scope that can be captured by the anonymous and use that instead:
The last parameter on that call is the scope for the callback. As you are passing the current this context, the callback would be called with that context.