User Interface20% of the exam

Component events, propagation and Lightning Message Service

Pick the communication channel from where two components sit: @api and aura:method calls down, LWC custom events and Aura component events up, Lightning Message Service or Aura application events across. Covers propagation flags, retargeting, message scope, owner versus container handling and LWC events caught by an Aura parent.

Official exam objective
Given a scenario, implement the correct method to communicate events through Lightning Web Components or Aura Components.

~8 min read · 11 practice questions ·

What the exam expects

  • Choose between an @api method, a custom event and Lightning Message Service (or aura:method, a component or an application event) from where the components sit.
  • Pick the most restrictive bubbles/composed configuration that reaches a given listener, and explain event.target retargeting.
  • Subscribe to a message channel with the right context and scope.
  • Fix Aura code that fires or handles a component or application event with the wrong syntax, or expects a container to handle an event.
  • Handle a Lightning web component's event in an enclosing Aura component.

Key terms: owner (the outermost component whose markup declares a component), container (a component that renders others through a facet such as {!v.body} without owning them), retargeting (changing event.target to an element in the listener's scope), message channel (the LightningMessageChannel Lightning Message Service publishes on).

Key facts

Default CustomEvent flags
Detail
bubbles: false, composed: false
LWC propagation phase
Detail
Bubbling only; capture isn't supported
Non-primitive detail
Detail
Copy to a new object first, or listeners can mutate it
Bubbles and composed event
Detail
Part of the public API; namespace the type
Default message scope
Detail
Active area only; utility items are always active
Whole-app subscription
Detail
{ scope: APPLICATION_SCOPE } as subscribe()'s fourth argument
pubsub module
Detail
Not officially supported; only where LMS isn't
Fire a component event
Detail
cmp.getEvent("registeredName") then fire()
Container handling
Detail
Add includeFacets="true" to the container's handler
Application event handler
Detail
No name attribute
aura:method
Detail
Parent calls the child's method directly; runs synchronously
Sources for this section (8)
  • Why is `bubbles: true, composed: true` discouraged for a reusable component's event?
  • When does a Lightning Message Service subscriber need `APPLICATION_SCOPE`?
  • Why doesn't a container that renders a child through `{!v.body}` handle the child's component event by default?
  • Which call gets an application event instance, and which gets a component event?
  • When does `event.target` differ from the element that dispatched an LWC event?

The questions are free to read. Answers with their sources and self-grading are included with the pack.

Keep reading with the Platform Developer II pack

  • Core concepts
  • Exam traps
  • Worked scenario

The pack includes:

  • All 28 lessons of the Platform Developer II guide, with reading progress
  • Interactive decision walks and step-by-step sequence steppers
  • Inline practice questions and one-click topic practice (11 questions for this lesson)
  • An official source cited for every claim
  • An AI tutor that answers from the guide
  • Unlimited timed practice exams

Practice for the Platform Developer II exam