Skip to content

Commit 6e175cd

Browse files
committed
Add CommonJS support
1 parent 433a106 commit 6e175cd

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎.jshintrc‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"undef": true,
1212
"globals": {
1313
"define": true,
14-
"jQuery": true
14+
"jQuery": true,
15+
"require": true
1516
}
1617
}

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Include script *after* the jQuery library (unless you are packaging scripts some
2020
**Do not include the script directly from GitHub (http://raw.github.com/...).** The file is being served as text/plain and as such being blocked
2121
in Internet Explorer on Windows 7 for instance (because of the wrong MIME type). Bottom line: GitHub is not a CDN.
2222

23-
The plugin can also be loaded as AMD module.
23+
The plugin can also be loaded as AMD or CommonJS module.
2424

2525
## Usage
2626

‎jquery.cookie.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
if (typeof define === 'function' && define.amd) {
1010
// AMD. Register as anonymous module.
1111
define(['jquery'], factory);
12+
} else if (typeof exports === 'object') {
13+
// CommonJS
14+
factory(require('jquery'));
1215
} else {
1316
// Browser globals.
1417
factory(jQuery);

0 commit comments

Comments
 (0)