I am building a permissions UI, I have a list of permissions with a select list next to each permission. The permissions are represented by an observable array of objects which
Actually you want to find whether the event is triggered by user or program , and its obvious that event will trigger while initialization.
The knockout approach of adding subscription
won't help in all cases, why because in most of the model will be implemented like this
(actual KO initilization)
(logical init like load JSON , get data etc)
The actual step that we want to capture is changes in 3, but in second step subscription
will get call ,
So a better way is to add to event change like
and detected the event in permissionChanged
function
this.permissionChanged = function (obj, event) {
if (event.originalEvent) { //user changed
} else { // program changed
}
}