O'Reilly logo

Hands-On Full Stack Web Development with Aurelia by Erikson Haziz Murrugarra Sifuentes, Diego Jose Arguelles Rojas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

subscribeOnce(event, callbackFunction)

This method is exactly the same as the subscribe() method, but with just one difference—it automatically unsubscribes the event once the callback is raised. Maybe in some cases, you will find some situations that just require a one-time subscription, such as our loading bar. The example is very similar to the subscribe() method example:

attached() {
     this.subscriber = this.ea.subscribeOnce('dataRetrievingEvent', response => {
         console.log(response.message);
     });
}

We are sure that you will find this feature really useful. This is just the beginning! Let's explore other awesome APIs!

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required