function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Big EarsBig Ears 

Lightning Components - Some Javascript questions

All,

I've been working through the "Lightning Components Basics" Trailhead module and found it to be, in the main, really helpful. However, there are a few points in the examples where methods/techniques are used which aren't clarified and I can't find in the documentation either. I'm trying to work out if these are specific to the Lightning implementation of Javascript, standard Javascript methods or something else that I should read for additional understanding:
  • When setting up asyncronous callback responses, there are 2 methods that I can't find in the Lightning documentation or with a Google search, so what are they native to?
    • getReturnValue()
    • getState()
  • When setting up a variable to run an apex method, there are methods which I have a similar issue with:
    • setParams()
  • ​In another module, 2 methods in the Helper class for a component call another method within the same Helper class with the "this." nomenclature. Given that these methods are all held in a map, is this a standard Javascript technique or something else?
If I've just missed stuff in the documentation, sorry! Feel free to tell me to RTM or link me to the appropriate resources.

Thanks!
 
Mark SFMark SF
getReturnValue(), getState(), and setParams() are all methods on the Action object. There is more details on them in https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_actions_call.htm

You can also get details in the JavaScript API > Action node of the reference doc app. See https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_doc_app.htm

Use this.helperMethod2() to call a second helper method from within a helper. This is the way to do it with Lightning components. I'll update the doc to make this clearer.

Thanks for the feedback!
wasabi 865wasabi 865
I have the same questions as mentioned above, but unfortunately I have still not been able to locate answers and one of the links (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_doc_app.htm) listed above is stale and first one still doesn't list any of available methods. Maybe I'm  not searching correclty, but any direction that you can provide one this will be greatly helpful. Seems there should be a "javadocs" like documentation on this somewhere. Thanks in advance for any help.