In every Lightning controller you have these outer parentheses wrapping the actual object:
({
getInput : function(cmp, evt) {
var myName = cmp.find("name").get("v.value");
var myText = cmp.find("outName");
var greet = "Hi, " + myName;
myText.set("v.value", greet);
}
})
So okay - this is making it an expression but what's the point? Somebody claimed that this is an IIFE but I don't think so, even though "normal" JavaScript libraries are doing it with an IIFE like this:
({
...
})();
Why is it wrapped in parentheses but missing the following parentheses, making it an IIFE? Why is it different to "normal" JavaScript libraries? What am I missing here?
I'm not doing JavaScript all day, so it's probably just something simple that I miss. I hope somebody can explain this.