Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

Example of wrapping 3rd party libraries with require.js #13

Closed
erikcw opened this issue Dec 22, 2011 · 3 comments
Closed

Example of wrapping 3rd party libraries with require.js #13

erikcw opened this issue Dec 22, 2011 · 3 comments

Comments

@erikcw
Copy link

erikcw commented Dec 22, 2011

It would be great to see a section on wrapping 3rd party javascript libraries that are not AMD compatible.

@addyosmani
Copy link
Owner

Hey @erikcw! I'm moving this to the wishlist thread so it can be centrally coordinated there #3.

Just to confirm: when you say wrapping 3rd party libraries, are you referring to things like say..google analytics or a retweet widget? Given that many of these now come with just a single external link to their JS source and some minor markup, I'm wondering if you're talking about wrapping this or the actual source in AMD.

Would most developers want to touch third party libraries in this way? (just thinking out loud) :)

@erikcw
Copy link
Author

erikcw commented Dec 30, 2011

Hi @addyosmani

I'm referring to a library like a jquery plugin, or https://github.com/PaulUithol/backbone-tastypie for example.

This library isn't currently setup to support AMD loaders, so to use it you have to create a require.js wrapper module and then access that wrapper from within the rest of your modules. Does that make sense? If there is a better pattern for this, I'm all ears.

@msteitle
Copy link

Very closely related to this (perhaps the same?) is keeping the global namespace clean when loading 3rd party libraries with requireJS. It would be great if there was a canonical way to load a library that doesn't have a noConflict method and still preserve the global namespace prior to loading your 3rd party JS in a page.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants