From 3c2f5d7dc6a363f08bfd2f9dfddcb87d8c68bd7f Mon Sep 17 00:00:00 2001 From: Kit Cross Date: Thu, 21 May 2015 15:58:44 -0400 Subject: [PATCH] Adds CommonJS/RequireJS support --- jquery.ajaxchimp.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jquery.ajaxchimp.js b/jquery.ajaxchimp.js index c803022..70af67a 100644 --- a/jquery.ajaxchimp.js +++ b/jquery.ajaxchimp.js @@ -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') { + module.exports = factory(require('jquery')); + } else { + factory(jQuery); + } +}(function ($) { 'use strict'; $.ajaxChimp = { @@ -144,4 +152,4 @@ For e.g. 'http://blahblah.us1.list-manage.com/subscribe/post-json?u=5afsdhfuhdsi }); return this; }; -})(jQuery); +})); \ No newline at end of file