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.

2 Answers 2

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

3
  • 2
    The cheatsheet is outdated .$A.run and $A.log and $A.newCmpAsync() are not supported any more . Commented May 11, 2017 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.
    – moth
    Commented May 11, 2017 at 23:45
  • 1
    @friendoflore I am not sure what replaced it but to log to console its recommended to use console.log() instead Commented May 12, 2017 at 1:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .