Book Image

Learning Salesforce Lightning Application Development

By : Mohit Shrivatsava
Book Image

Learning Salesforce Lightning Application Development

By: Mohit Shrivatsava

Overview of this book

Built on the Salesforce App Cloud, the new Salesforce Lightning Experience combines three major components: Lightning Design System, Lightning App Builder, and Lightning Components, to provide an enhanced user experience. This book will enable you to quickly create modern, enterprise apps with Lightning Component Framework. You will start by building simple Lightning Components and understanding the Lightning Components architecture. The chapters cover the basics of Lightning Component Framework semantics and syntax, the security features provided by Locker Service, and use of third-party libraries inside Lightning Components. The later chapters focus on debugging, performance tuning, testing using Lightning Testing Services, and how to publish Lightning Components on Salesforce AppExchange.
Table of Contents (22 chapters)
Title Page
PacktPub.com
Foreword
Contributors
Preface
Index

Component events


The primary difference between component events and application events is that a component event does not have the default phase, and hence, it cannot be used if two components are not part of the same tree.

Syntactically, they defer from an application by requiring a name for the handler, and they do not use the $A global provider.

Also, note that the default event propagation rules for capture and bubbling are exactly the same as those we discussed in the previous section. A default handler without a phase parameter in aura:handler indicates the bubble phase.

Component events are more performant; unless you need application events, you should always use component events.

Creating a component event

To create a component event, create a a.evt file using the Developer Console; the type is specified as the COMPONENT:

<!--c:compEvent-->
<aura:event type="COMPONENT">
 <!-- Add aura:attribute tags to define event shape.
   One sample attribute here. -->
 <aura...