Skip to content

Instantly share code, notes, and snippets.

@jbnv
Created June 2, 2015 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbnv/dc10c4350c00c41f8301 to your computer and use it in GitHub Desktop.
Save jbnv/dc10c4350c00c41f8301 to your computer and use it in GitHub Desktop.
'console' custom binding for Knockout. Lets us dump a variable to the console from within our HTML.
composition.addBindingHandler('console', {
update: function (element, valueAccessor, allBindings) {
data = ko.toJS(valueAccessor() || allBindings());
console.log(data);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment