9

I'm starting to learn Lightning development. In the JS controller, out of curiosity, what exactly is the $A object?

I see it is used in the context of $A.enqueueAction(...), $A.getCallback(), and $A.utils. Is it a collection of "Aura" utility methods?

Forgive the ignorant question - hard to search for documentation/explanation for it.

12

Yes, $A is how you gain access to the underlying Aura framework, such as enqueuing actions, getting application events, managing the Aura rendering life cycle, and various utility methods. You can view the available methods using AuraDocs, located on your server at /auradocs/reference.app. You can access it using the production or sandbox links I've provided here. You'll find the full list in the JavaScript API section.

2

The Aura object is the top-level object in the JavaScript framework code. $A is shorthand for Aura.

Refer documentation

  • 2
    The cheatsheet is outdated .$A.run and $A.log and $A.newCmpAsync() are not supported any more . – Mohith Shrivastava May 11 '17 at 23:12
  • 1
    @MohithShrivastava What replaced $A.log? I see that $A.run should be replaced by $A.getCallback and $A.newCmpAsync should be replaced by $A.createComponent in the docs posted by @sfdcfox above. – friendoflore May 11 '17 at 23:45
  • 1
    @friendoflore I am not sure what replaced it but to log to console its recommended to use console.log() instead – Mohith Shrivastava May 12 '17 at 1:20

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.