Skip to content

Commit 777394e

Browse files
committed
Correctly support amd node and browser environments
1 parent 8c597e8 commit 777394e

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/jquery-ui-timepicker-addon.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@
77
* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
88
*/
99

10-
(function (factory) {
11-
if (typeof define === 'function' && define.amd) {
12-
define(['jquery', 'jquery.ui'], factory);
13-
} else {
14-
factory(jQuery);
15-
}
16-
}(function ($) {
10+
(function (window, factory) {
11+
if (typeof define === 'function' && define.amd) {
12+
// AMD. Register as an anonymous module.
13+
define(['jquery'], function(){
14+
return factory.apply(window, arguments);
15+
});
16+
} else if (typeof module === 'object' && module.exports) {
17+
// NodeJS.
18+
module.exports = factory.call(window, require('jquery'));
19+
} else {
20+
// Browser globals
21+
factory.call(window, window.jQuery);
22+
}
23+
}(typeof global === 'object' ? global : this, function ($) {
24+
1725

1826
/*
1927
* Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"

0 commit comments

Comments
 (0)