Skip to content

Commit 41ee549

Browse files
trentrichardson#793 - Adding support for AMD
1 parent d57c77b commit 41ee549

5 files changed

+23
-8
lines changed

Gruntfile.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ module.exports = function(grunt) {
162162
grunt.loadNpmTasks('grunt-contrib-watch');
163163

164164
// Default task.
165-
grunt.registerTask('default', ['jshint', 'jasmine', 'clean', 'copy', 'concat', 'replace', 'uglify', 'cssmin']);
165+
grunt.registerTask('default', ['clean', 'copy', 'concat', 'replace', 'uglify', 'cssmin']);
166+
167+
// Test task.
168+
grunt.registerTask('test', ['jshint', 'jasmine']);
166169

167170
};

dist/jquery-ui-timepicker-addon.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
/*! jQuery Timepicker Addon - v1.5.1 - 2014-09-01
22
* http://trentrichardson.com/examples/timepicker
33
* Copyright (c) 2015 Trent Richardson; Licensed MIT */
4-
(function ($) {
4+
(function (factory) {
5+
if (typeof define === 'function' && define.amd) {
6+
define(['jquery', 'jquery.ui'], factory);
7+
} else {
8+
factory(jQuery);
9+
}
10+
}(function ($) {
511

612
/*
713
* Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
@@ -2235,4 +2241,4 @@
22352241
*/
22362242
$.timepicker.version = "1.5.1";
22372243

2238-
})(jQuery);
2244+
}));

dist/jquery-ui-timepicker-addon.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/.jshintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"boss": true,
1414
"eqnull": true,
1515
"browser": true,
16-
"predef": ["jQuery"]
16+
"predef": ["jQuery","define"]
1717
}

src/jquery-ui-timepicker-addon.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
88
*/
99

10-
(function ($) {
10+
(function (factory) {
11+
if (typeof define === 'function' && define.amd) {
12+
define(['jquery', 'jquery.ui'], factory);
13+
} else {
14+
factory(jQuery);
15+
}
16+
}(function ($) {
1117

1218
/*
1319
* Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
@@ -2241,4 +2247,4 @@
22412247
*/
22422248
$.timepicker.version = "@@version";
22432249

2244-
})(jQuery);
2250+
}));

0 commit comments

Comments
 (0)