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!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset