Last active
April 18, 2016 09:06
-
-
Save lpaulger/1ae8a6a828b931831b6884d93309b39d to your computer and use it in GitHub Desktop.
example UMD module
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
;(function(root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define(['jquery'], factory); | |
} else if (typeof exports === 'object') { | |
module.exports = factory(require('jquery')); | |
} else { | |
root.MyModule = factory(root.jQuery); | |
} | |
}(this, function($) { | |
'use strict' | |
var MyModule = { | |
foo: function() { | |
//example with external dependency | |
return $.doSomething(); | |
}, | |
bar: function() { | |
//content | |
} | |
} | |
return MyModule; | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment