Skip to content

Commit 9c1d399

Browse files
committed
load as AMD module if AMD is available
1 parent c155b4b commit 9c1d399

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

jquery.mjs.nestedSortable.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,20 @@
1010
* Licensed under the MIT License
1111
* http://www.opensource.org/licenses/mit-license.php
1212
*/
13-
14-
(function($) {
13+
(function( factory ) {
14+
if ( typeof define === "function" && define.amd ) {
15+
16+
// AMD. Register as an anonymous module.
17+
define([
18+
"jquery",
19+
"jquery-ui/sortable"
20+
], factory );
21+
} else {
22+
23+
// Browser globals
24+
factory( jQuery );
25+
}
26+
}(function($) {
1527

1628
function isOverAxis( x, reference, size ) {
1729
return ( x > reference ) && ( x < ( reference + size ) );
@@ -649,4 +661,4 @@
649661
}));
650662

651663
$.mjs.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options);
652-
})(jQuery);
664+
}));

0 commit comments

Comments
 (0)