Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Events Anti-Patterns
Don't Fire an Event in a Renderer
Firing an event in a renderer can cause an infinite rendering loop.
Don’t do this!
1afterRender: function(cmp, helper) {
2 this.superAfterRender();
3 $A.get("e.myns:mycmp").fire();
4}Instead, use the init hook to run a controller action after component construction but before rendering. Add this code to your component:
1<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>For more details, see .Invoking Actions on Component Initialization.
Don’t Use onclick and ontouchend Events
You can’t use different actions for onclick and ontouchend events in a component. The framework translates touch-tap events into clicks and activates any onclick handlers that are present.