Skip to content

Instantly share code, notes, and snippets.

@thelinuxlich
Created February 27, 2012 14:30
Show Gist options
  • Save thelinuxlich/1924229 to your computer and use it in GitHub Desktop.
Save thelinuxlich/1924229 to your computer and use it in GitHub Desktop.
/** Dependent observable with callback on write */
Function.prototype.intercept = function(callback) {
var underlyingObservable = this;
return ko.dependentObservable({
read: underlyingObservable,
write: function(value) { callback.call(underlyingObservable,
value) }
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment