Skip to content

Instantly share code, notes, and snippets.

@zhusee2
Last active December 19, 2015 10:49
Show Gist options
  • Save zhusee2/5943380 to your computer and use it in GitHub Desktop.
Save zhusee2/5943380 to your computer and use it in GitHub Desktop.
Example script files from the concept of "Structure JavaScript with Module Pattern" on CSS-Tricks. (http://css-tricks.com/how-do-you-structure-javascript-the-module-pattern-edition/)
var NewsWidget = {
init: function() {
// Do some init stuffs
}
otherMethods: function() {
// Expend the ability of the widget
}
};
//= require common/library.js
//= require module/news-widget.js
//= require module/some-other-widget.js
(function() {
NewsWidget.init();
SomeOtherModule.init();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment