Skip to content

Commit

Permalink
Merge pull request #100 from Narsul/patch-1
Browse files Browse the repository at this point in the history
Added support of AMD and common.js module
  • Loading branch information
Alfiana Sibuea committed Mar 26, 2015
2 parents 231fa26 + 3f60ebc commit d551871
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/js/waves.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,29 @@
* https://github.com/fians/Waves/blob/master/LICENSE
*/

;(function(window) {
'use strict';
;(function(window, factory) {
"use strict";

// AMD. Register as an anonymous module. Wrap in function so we have access
// to root via `this`.
if (typeof define === "function" && define.amd) {
define([], function() {
return factory.apply(window);
});
}

// Node. Does not work with strict CommonJS, but only CommonJS-like
// environments that support module.exports, like Node.
else if (typeof exports === "object") {
module.exports = factory.call(window);
}

// Browser globals.
else {
window.Waves = factory.call(window);
}
})(typeof global === "object" ? global : this, function () {
"use strict";

var Waves = Waves || {};
var $$ = document.querySelectorAll.bind(document);
Expand Down Expand Up @@ -324,5 +345,5 @@
element.addEventListener('mousedown', showEffect, false);
};

window.Waves = Waves;
})(window);
return Waves;
});

0 comments on commit d551871

Please sign in to comment.