Skip to content

Instantly share code, notes, and snippets.

@quipu
Created June 16, 2014 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quipu/c983f1e29186c31b029c to your computer and use it in GitHub Desktop.
Save quipu/c983f1e29186c31b029c to your computer and use it in GitHub Desktop.
Example of basic module pattern.
var dom = (function() {
var _counter = 0;
return {
generateId : function () {
return "customId" + _counter++;
},
create : function(tagName, id) {
var el = document.createElement(tagName);
el.id = id || this.generateId();
return el;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment