Skip to content

Instantly share code, notes, and snippets.

@anthonyshort
Created April 24, 2014 04:50
Show Gist options
  • Save anthonyshort/11241906 to your computer and use it in GitHub Desktop.
Save anthonyshort/11241906 to your computer and use it in GitHub Desktop.
function update (data) {
var request = new XMLHttpRequest();
request.open('POST', '/whatevers', true);
request.send(data);
}
var View = ripple(template)
.use(events);
// Might need different change events for each field
View.prototype.onChange = function (event) {
this.set('fieldName', event.target.value); // or whatevers
this.emit('change');
};
View.prototype.toJSON = function () {
return this.data;
};
var view = new View();
view.appendTo('body');
view.on('change', function(){
var data = view.toJSON();
update(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment