You can clone with
Now that jQuery is exposing itself w/ define, I feel like this will catch on more.
The easiest implementation would be:
But the most correct would be to not use a global variable at all if an AMD loader exists on the page (underscore.js does a good job of this, I believe).
This allows amplify to be loaded using RequireJS or equivalent.
I second this issue and would love to see it done. Thanks!
Bumping this to update everyone - the current plan is to write in AMD support - at least starting with the combined core/store/request build output. Are any of you using custom amd wrappers around the individual amplify libs? What about using amplify in projects that are mixing amd and standard js libs? (I ask that last one b/c some of the amd wrappers can have some issues in hybrid projects)....
Custom amd wrappers around individual amplify libs: no.
Using amplify in projects that are mixing amd and standard js libs: yes.
Not sure how that relates to amplify's amd support though.
This seems to work for me:
https://gist.github.com/2137980 via ifandelse
@andrhamm - glad that's working. I noticed the version says 1.0.0, but it looks like the 1.1.0 code base, and when I created that gist, that's what I would have pulled...so...my bad on the wrong version in the comments. I have the AMD build pieces working locally, just need to dot my i's and cross my t's on a few things (including tests) before I submit the pull req and get it merged in...
@andrhamm thanks a lot, that works indeed! will be using your version, at least till new version of amplify with AMD support available :)
As of RequireJS 2.0, it is now possible to use non-amd modules in a project via the shim config in require.config.
Here is a gist of the working code.
Hopefully that will help!
The shim that @jcreamer898 is talking about should work for most situations (both full AMD and hybrid projects). We will still produce an amd-compliant build at some point in the near future since a true amd version will pull amplify out of the global scope (since the shim wouldn't).
Oh just saw that I've started another Issue on the same topic... Here is a cool site with help :https://github.com/umdjs/umd/
Is this still happening?
@benjamincox Yes… I apologize for the slow inclusion of this feature. I need to get the roadmap sketched out for Amplify so we can move it forward in a more focussed way.