Skip to content

Instantly share code, notes, and snippets.

@lukasborawski
Last active August 29, 2015 14:17
Show Gist options
  • Save lukasborawski/9087a53d02066710c86b to your computer and use it in GitHub Desktop.
Save lukasborawski/9087a53d02066710c86b to your computer and use it in GitHub Desktop.
MVC JavaScript App Structure
var _userForm = {
getElement: {
d: $(document),
f: $('.js-userForm')
},
send: function() {
var self = this;
self.getElement.d.on('click', self.getElement.f, function(e) {
e.preventDefault();
var t = $(this);
requirejs(["formModel"], function() {
var formModel = _formModel.post(t.parents('form'), t);
});
});
return self;
}
}
var userForm = _userForm.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment