Valid B2B-Commerce-Developer Dumps shared by ExamDiscuss.com for Helping Passing B2B-Commerce-Developer Exam! ExamDiscuss.com now offer the newest B2B-Commerce-Developer exam dumps, the ExamDiscuss.com B2B-Commerce-Developer exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com B2B-Commerce-Developer dumps with Test Engine here:
A developer needs to create an event listener on a parent component programmaticallv. With the script below, what should replace the text <EVENT LISTENER UNE>?
Correct Answer: C
Explanation To create an event listener on a parent component programmatically, the developer should use the following line of code: this.template.addEventListener('notification', this.handleNotification); This line of code adds an event listener to the template element of the parent component, which is the root element that contains all the child elements. The event listener listens for an event named 'notification', which is a custom event that can be dispatched by any child component. The event listener invokes a method named handleNotification, which is an arrow function defined in the parent component class. The handleNotification method receives the event object as a parameter and can perform any logic based on the event data. The other lines of code are either incorrect or incomplete. Salesforce References: Lightning Web Components Developer Guide: Communicate with Events, Lightning Web Components Developer Guide: Create and Dispatch Events