jquery-ujs
jquery-ujs copied to clipboard
Add support to be loaded as an AMD module
It'd be great if jquery-ujs defined itself so it could be loaded by RequireJS (http://requirejs.org/) with jQuery as a dependency.
Newer versions of jQuery now support this, so one would be able to list jquery_ujs as a dependency instead of jquery in their modules and require.js would do the right thing.
For now, I'm going to mark this as a potential future enhancement. I'm not opposed to adding AMD support, but I'm cautiously skeptical. The issues with adding AMD support are described in-depth in this thread for underscore.js and [this discussion in sylvester.js[(https://github.com/jcoglan/sylvester/issues/8#issuecomment-7207071).
The short version is, adding AMD support could potentially break applications which happen to be using RequireJS but not for jquery-ujs. This can be avoided by defining some boilerplate to load both the AMD definition and the global namespace, but it's a lot of boilerplate considering you can already use jquery-ujs with RequireJS using the shim config.
@JangoSteve +1 for this. Fun running into you on this thread. Hope you're well.