Created
June 16, 2014 08:58
-
-
Save quipu/104a697407d6507904ae to your computer and use it in GitHub Desktop.
Example module using Asynchronous Module Definition (AMD) design 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
define(function() { | |
var _counter = 0; | |
function generateId() { | |
return "customId" + _counter++; | |
} | |
function create(tagName, id) { | |
var el = document.createElement(tagName); | |
el.id = id || generateId(); | |
return el; | |
} | |
return { | |
generateId : generateId, | |
create : create | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this module you'll require using a scriptloader like RequireJS.