Created
April 24, 2014 04:50
-
-
Save anthonyshort/11241906 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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