0

This is a general quastion about handling callbacks in MVVM/MVC pattern.

What ways there are to handle an asynchronous callback function from the Model in the Controller/View-Model.

For example:

I have a function in the model that start her work after receiving a packet throught the network.

LamaTo
  • 540
  • 1
  • 8
  • 21

2 Answers2

0

The VM represents the Model for the View, therefore it has full knowledge of the Model and can for instance subscribe to events of the Model.

Ian
  • 323
  • 3
  • 8
0

I subscribe to the school of thought that in MVVM applications, the Model classes should be relatively dumb. In situations like this the ViewModel (via an injected service) will handle the network update notifications and make any required updates to the Model and indirectly to the View.

Peregrine
  • 4,287
  • 3
  • 17
  • 34