Hands-On Full Stack Web Development with Aurelia
by Diego Argüelles Rojas, Erikson Murrugarra Murrugarra Sifuentes
publish(event, data)
This method allows you to fire events. Remember that our EventAggregator will be placed in some parent component, so you know which components will be subscribed to it. So, because of that, this method does not have a specific target; they are just events triggered to space and doesn't matter if they have zero or more subscribers.
The first argument is the event name. You can choose any name for this, as it is your custom event. It will be used as an identifier to call it from external components across our application. In this case, you can use EventAggregator to configure our loading bar, so it would be right to name our event according to it. We will call it dataRetrievingEvent.
The second argument is the data you ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access