Created
June 16, 2014 09:01
-
-
Save quipu/c983f1e29186c31b029c to your computer and use it in GitHub Desktop.
Example of basic module pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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