0

I'm trying to get some debug information from my application, but setting breakpoints in my code is very time consuming.

I registered an application event named "debug" and added a handler in my component that will spit out some debug information (using console.log). I set the access control to "global":

debug.evt

<aura:event type="APPLICATION" access="global" />

I was hoping that I could just create and fire the event from the javascript developer console:

> $A.get('e.namespace:debug')

... but that just returned undefined. I'm still new to developing in Lightning and I'm beginning to question whether this is even possible.

  • I think I've got all the relevant information in my question, but if there's something I'm missing just let me know in the comments and I'll update as soon as I can. – JDB Jul 18 '17 at 22:18
1

Oops...

Looks like it was as easy as I had hoped after all, I just hadn't actually added the handler to my component yet. As soon as I added the handler, the event was recognized and I was able to create it from the console.

For posterity, here's the handler XML I added to my component (which must actually be loaded on the screen for this to work):

<aura:handler event="c:debug" action="{!c.handleDebug}"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.