Created
April 28, 2016 17:55
-
-
Save robflaherty/1e734234d55f39bc3e151ce3afeac899 to your computer and use it in GitHub Desktop.
UMD
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
/* 1 */ | |
(function(factory) { | |
if (typeof define === 'function' && define.amd) { | |
// AMD | |
define(['jquery'], factory); | |
} else if (typeof module === 'object' && module.exports) { | |
// CommonJS | |
module.exports = factory(require('jquery')); | |
} else { | |
// Browser globals | |
factory(jQuery); | |
} | |
}(function($) { | |
$.fn.jqueryPlugin = function () { return true; }; | |
})); | |
/* 2 */ | |
(function(factory) { | |
if (typeof define === 'function' && define.amd) { | |
// AMD | |
define(['jquery'], factory); | |
} else if (typeof module === 'object' && module.exports) { | |
// CommonJS | |
factory(require('jquery')); | |
} else { | |
// Browser globals | |
factory(jQuery); | |
} | |
}(function($) { | |
$.fn.jqueryPlugin = function () { return true; }; | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
module.exports = factory(require('jquery'));
vs
factory(require('jquery'));
Are these functionally the same? Is assigning to module.exports redundant?