I come from Angular (which has/had event emitting) and I see that Knockout has 'observables'/pubsub, though I could not fully grasp the concept of this with using separate view models.
Here is an example of what I'm trying to do:
I have an array of objects in VM1 that when an element is updated, I want to emit an event saying that "this object has changed, please update accordingly!" and also passes the object.
I found this on the KO documentation:
For advanced users, if you want to register your own subscriptions to be notified of changes to observables, you can call their subscribe function.
myViewModel.personName.subscribe(function(newValue) {
alert("The person's new name is " + newValue);
});
However it does not mention who is publishing any changes to "myViewModel". Can anyone clarify this?
In my example, do I bind an observable array to the parent object (possibly ko)?
Edit:
Here is the example:
A user has at least one user that they can manage.
I have one VM that is responsible for displaying a single user's user account settings page. I have another VM that is responsible for displaying all the user's users at a time. If a user clicks on a row (a user's user), a panel comes out to change that row's data. When a row is changed, I want to update the main list of user's users.