Javascript universal module format
myModule depends on lodash and jquery, for example
(function (root, definition) { | |
var _module_name = "myModule"; | |
if (typeof define === 'function' && define.amd) { | |
define(['jquery', 'lodash'], function($, _){ | |
return (root[_module_name] = definition($, _)); | |
}); | |
} else { | |
root[_module_name] = definition($, _); | |
} | |
}(this, function ($, _, undefined) { | |
'use strict'; | |
return {}; | |
})); |