Created
October 30, 2013 20:09
-
-
Save terinjokes/7239380 to your computer and use it in GitHub Desktop.
Friendlier jQuery in CommonJS enivronments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(fn) { | |
function setup($) { | |
return $.fn.extend(fn(jQuery)); | |
} | |
if (typeof exports === 'object') { | |
module.exports = setup; | |
} else { | |
setup(jQuery || Zepto); | |
} | |
}(function($) { | |
return { | |
gmap: function() { | |
this.each(function(index, elem) { | |
$(elem).append('<pre>GMaps</pre>'); | |
}); | |
}, | |
gnoop: function() {} | |
} | |
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(fn) { | |
function setup($) { | |
return $.fn.gmap = fn($); | |
} | |
if (typeof exports === 'object') { | |
module.exports = setup | |
} else { | |
setup(jQuery || Zepto); | |
} | |
}(function($) { | |
return function() { | |
this.each(function(index, elem) { | |
$(elem).append('<pre>GMaps</pre>'); | |
}); | |
} | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In multiple.jquery.js, shouldn't it be
$.fn.extend($)
instead of$.fn.extend(jQuery)
?