Skip to content

Commit 927d7fe

Browse files
Merge pull request #103 from ThyNameIsMud/requirejs-format
Proper Requirejs/CommonJS format
2 parents bde8b24 + 0f1254c commit 927d7fe

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

dist/easyzoom.js

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

src/easyzoom.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
(function ($) {
1+
(function (root, factory) {
2+
'use strict';
3+
if(typeof define === 'function' && define.amd) {
4+
define(['jquery'], function($){
5+
factory($);
6+
});
7+
} else if(typeof module === 'object' && module.exports) {
8+
module.exports = (root.EasyZoom = factory(require('jquery')));
9+
} else {
10+
root.EasyZoom = factory(root.jQuery);
11+
}
12+
}(this, function ($) {
213

314
'use strict';
415

@@ -320,14 +331,4 @@
320331
}
321332
});
322333
};
323-
324-
// AMD and CommonJS module compatibility
325-
if (typeof define === 'function' && define.amd){
326-
define(function() {
327-
return EasyZoom;
328-
});
329-
} else if (typeof module !== 'undefined' && module.exports) {
330-
module.exports = EasyZoom;
331-
}
332-
333-
})(jQuery);
334+
}));

0 commit comments

Comments
 (0)