Permalink
Browse files

amd+commonjs loaders

  • Loading branch information...
1 parent 9430043 commit 1e2e47b4766d7c0a6163871e51e2ecad2af57525 @davidhellsing davidhellsing committed Nov 20, 2013
Showing with 14 additions and 5 deletions.
  1. +14 −5 src/galleria.js
View
@@ -7,13 +7,12 @@
*
*/
-(function( $, Galleria, undef ) {
+(function( $, window, Galleria, undef ) {
/*global jQuery, navigator, Image */
// some references
-var window = this,
- doc = window.document,
+var doc = window.document,
$doc = $( doc ),
$win = $( window ),
@@ -1115,7 +1114,7 @@ $win.on( 'orientationchange', function() {
*/
-Galleria = window.Galleria = function() {
+Galleria = function() {
var self = this;
@@ -6792,6 +6791,16 @@ $.fn.galleria = function( options ) {
};
+// export as AMD or CommonJS
+if ( typeof module === "object" && module && typeof module.exports === "object" ) {
+ module.exports = Galleria;
+} else {
+ window.Galleria = Galleria;
+ if ( typeof define === "function" && define.amd ) {
+ define( "galleria", ['jquery'], function() { return Galleria; } );
+ }
+}
+
// phew
-}( jQuery ) );
+}( jQuery, this ) );

0 comments on commit 1e2e47b

Please sign in to comment.