vendredi 12 décembre 2014

Synchronizing events in a MVVM application

I have a component that might take quite a bit to initialize (a gmappanel to be precise), and a store that could potentially take some time to load. Once the gmappanel has fired its mapready event and the store has fired its loaded event, I want to invoke some methods on my gmappanel.

So, what is the recommended / best practice / most MVVM-ish way / ... way to solve this? I would like to avoid polling, but as far as I can see there's now way to do what i want without some polling mechanism.


What I'm doing now is I subscribed to the store's load event, and add the records I need to the gmappanel as a new property. That way, when the gmappanel's mapready event fires second I can do my stuff.


The other way round I'm polling the store's .isLoaded() method.


Also, I found this thread on SOF: http://ift.tt/1GsVBbg


Is this the recommended approach?






Synchronizing events in a MVVM application

Aucun commentaire:

Enregistrer un commentaire