Skip to content

Adds CommonJS/RequireJS support #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions jquery.ajaxchimp.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ To get the mailchimp JSONP url (undocumented), change 'post?' to 'post-json?' an
For e.g. 'http://blahblah.us1.list-manage.com/subscribe/post-json?u=5afsdhfuhdsiufdba6f8802&id=4djhfdsh99f&c=?',
*/

(function ($) {
;(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not very familiar with requireJS, so I may be way off base here, but should this not be

else if (typeof module === 'object' && module && module.exports) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm. seems both would work based on this: https://github.com/substack/browserify-handbook#exports

module.exports = factory(require('jquery'));
} else {
factory(jQuery);
}
}(function ($) {
'use strict';

$.ajaxChimp = {
Expand Down Expand Up @@ -144,4 +152,4 @@ For e.g. 'http://blahblah.us1.list-manage.com/subscribe/post-json?u=5afsdhfuhdsi
});
return this;
};
})(jQuery);
}));