Skip to content

Commit fb6aa59

Browse files
committed
Adding support for AMD. Closes #59.
1 parent 99b58ac commit fb6aa59

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎grunt.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = function (grunt) {
2626
undef: true
2727
},
2828
globals: {
29+
define: true,
2930
jQuery: true
3031
}
3132
}

‎jquery.cookie.js‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@
55
* Copyright 2013 Klaus Hartl
66
* Released under the MIT license
77
*/
8-
(function ($, document, undefined) {
8+
(function (factory) {
9+
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
10+
// AMD. Register as anonymous module.
11+
define(['jquery'], factory);
12+
} else {
13+
// Browser globals.
14+
factory(jQuery);
15+
}
16+
}(function ($) {
917

1018
var pluses = /\+/g;
1119

@@ -83,4 +91,4 @@
8391
return false;
8492
};
8593

86-
})(jQuery, document);
94+
}));

0 commit comments

Comments
 (0)