YUI has a nice way of creating a namespace for your methods etc. in javascript.
Does jQuery have anything similiar?
All credit to @Diego Fluery, I just took his slide deck and made a runnable code prototype, but it might save you a few minutes if you go this route:
<!DOCTYPE html>
<html>
<head>
<script type="application/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="application/javascript">
$(document).ready(function() {
(function () {
$.fn.AppRedirect = function() {
this.sendRequest = parts.sendRequest;
this.doRedirect = parts.doRedirect;
return this;
}
var parts = {
doRedirect: function() {
console.log('doRedirect');
},
sendRequest: function() {
console.log('sendRequest');
}
};
})();
$("body").AppRedirect().sendRequest();
$("body").AppRedirect().doRedirect();
});
</script>
</head>
<body>
</body>
</html>
jQuery has a bunch of plugins that extend the base functionality. There is this plugin for easy namespaces.