From b4a84d1f213a030eb3e971e68484bac3e35984b9 Mon Sep 17 00:00:00 2001 From: Kushagra Sharma Date: Fri, 20 Jul 2018 15:57:41 +0530 Subject: [PATCH] add AMD support --- src/Scripts/jquery.fileDownload.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Scripts/jquery.fileDownload.js b/src/Scripts/jquery.fileDownload.js index 353ac64..52bcca5 100644 --- a/src/Scripts/jquery.fileDownload.js +++ b/src/Scripts/jquery.fileDownload.js @@ -14,7 +14,18 @@ * !!!!NOTE!!!! */ -(function($, window){ +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS + module.exports = factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } + }(function($, window){ // i'll just put them here to get evaluated on script load var htmlSpecialCharsRegEx = /[<>&\r\n"']/gm; var htmlSpecialCharsPlaceHolders = { @@ -490,4 +501,4 @@ $.extend({ } }); -})(jQuery, this || window); +})(jQuery, this || window));