Skip to content

Instantly share code, notes, and snippets.

@fflorent
Last active August 29, 2015 14:00
Show Gist options
  • Save fflorent/11225982 to your computer and use it in GitHub Desktop.
Save fflorent/11225982 to your computer and use it in GitHub Desktop.
AMD using require and the default parameters
/**
* AMD's define function using ES6 default parameter and require.
*
* With some tweaks of AMD and using an ES6 Browser, this idioms intends to improve readability
* and maintainability of modules declared with define()... At least, until browsers implement
* ES6 Modules.
*/
define("mymodule", function(
r = require,
module1 = r("module1"),
lib1 = r("lib/lib1"),
...
) {
var MyModule = {};
// ....
return MyModule;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment