mikehostetler / amplify

AmplifyJS
http://amplifyjs.com
GNU General Public License v2.0
1.45k stars 144 forks source link

Expose amplify in AMD format #43

Closed zachleat closed 6 years ago

zachleat commented 12 years ago

Now that jQuery is exposing itself w/ define, I feel like this will catch on more.

The easiest implementation would be:

define('amplify', function() { return amplify; });

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.

aberman commented 12 years ago

I second this issue and would love to see it done. Thanks!

t2k commented 12 years ago

Yuuuuuuuuuup

ifandelse commented 12 years ago

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)....

zachleat commented 12 years ago

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.

andrhamm commented 12 years ago

This seems to work for me:

https://gist.github.com/2137980 via ifandelse

ifandelse commented 12 years ago

@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...

alexbeletsky commented 12 years ago

@andrhamm thanks a lot, that works indeed! will be using your version, at least till new version of amplify with AMD support available :)

jcreamer898 commented 12 years ago

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.

https://gist.github.com/3107540

Hopefully that will help!

ifandelse commented 12 years ago

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).

mariusfilipowski commented 12 years ago

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/

brianmhunt commented 11 years ago

:thumbsup: for UMD.

benjamincox commented 11 years ago

Is this still happening?

dcneiner commented 11 years ago

@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.

benjamincox commented 11 years ago

Awesome! Thanks, Douglas!

On Aug 20, 2013, at 10:43 AM, Douglas Neiner notifications@github.com wrote:

@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.

— Reply to this email directly or view it on GitHub.

SiteSplat commented 9 years ago

@ifandelse are you still around and developing this? it would be nice to know. It's been almost two years now. :-/

zachleat commented 6 years ago

If someone else wants this, please reopen with a new issue. Don’t think AMD is really relevant any more.