Skip to content

Instantly share code, notes, and snippets.

@foleyatwork
Created September 8, 2015 16:22
Show Gist options
  • Save foleyatwork/a8148651dff28b3b9987 to your computer and use it in GitHub Desktop.
Save foleyatwork/a8148651dff28b3b9987 to your computer and use it in GitHub Desktop.
An example of the old way of creating controllers.
/*
* This way of creating a controller has a few issue:
* 1. It buries the namespace declaration at the bottom of the document.
* 2. It creates an unnecessary abstraction of the namespace that may not be obvious to developers.
* 3. It requires retyping the namespace in every single file.
*/
(function(exports) {
var HelloWorld = function() {
console.log('Hello, World!');
}
exports.HelloWorld = HelloWorld.
}(window.Site.Controllers));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment