Last active
January 9, 2016 09:54
-
-
Save J2TEAM/6c4822a42316c79daf51 to your computer and use it in GitHub Desktop.
This file contains 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
// Ref: https://github.com/umdjs/umd/blob/master/templates/amdWeb.js | |
(function(root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define(['moduleName'], factory); | |
} else { | |
root.moduleName = factory(root.moduleName); | |
} | |
}(this, function(moduleName) { | |
'use strict'; | |
var privateVar, privateMethod; | |
privateVar = 'something'; | |
privateMethod = function(name) { | |
console.log('Hello, ' + name); | |
}; | |
// Public variables and methods | |
return { | |
publicVar: 'something else', | |
publicMethod: function() { | |
return privateVar; // Access to private variable | |
} | |
}; | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment