Skip to content

Instantly share code, notes, and snippets.

@artemhp
Last active August 15, 2019 18:15
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 artemhp/badabd55c9df2499a25819520aa8a7c1 to your computer and use it in GitHub Desktop.
Save artemhp/badabd55c9df2499a25819520aa8a7c1 to your computer and use it in GitHub Desktop.
IIFE. Exposing public variables
( function( global, factory ) {
if ( typeof module === "object" ) {
module.exports =
global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window" );
}
return factory( w );
};
} else {
factory( global );
}
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
jQuery = {};
if ( !noGlobal ) {
window.jQuery = window.$ = jQuery;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment