I have a change occurring to an array. I am using Sanderson's latest array subscription method to catch the add/delete change. In this subscription is where I intend to bundle and send my request over the wire. If the request fails for any reason I want to be able to cancel any possible changes to the collection. I have verified that this subscription is hit before the change propagates so I assume there would be a way to say "STOP DON'T DO IT" however I can't figure out how.
As my example...
self.SourceData = ko.observableArray(data);
self.SourceData.subscribe(function(changes) {
var isAllGood = true;
ko.utils.arrayForEach(changes, function(ch) {
if (ch.value == doesNotMeetMyCondition) isAllGood = false;
});
if (!isAllGood) <STOP DON'T DO IT>
}, null, 'arrayChange');
When inspecting 'this' I do see the ko.subscription object with the standard [callback, dispose, disposeCallback, target] but nothing seems to amount to STOP DON'T DO IT.
Any thoughts would be quite helpful. Thanks.