Skip to content

Instantly share code, notes, and snippets.

@jakelazaroff
Created October 10, 2013 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakelazaroff/6914043 to your computer and use it in GitHub Desktop.
Save jakelazaroff/6914043 to your computer and use it in GitHub Desktop.
Adapt non-AMD compliant code.
// make sure AMD is available
if (typeof define !== "undefined")
// define a module for the library
define([], function(){
// create a local copy
var EvilNonAmdSupportingLibrary = window.EvilNonAmdSupportingLibrary;
// remove the copy in the global namespace
window.EvilNonAmdSupportingLibrary = undefined;
// return the local copy to AMD library
return EvilNonAmdSupportingLibrary;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment