Skip to content

Commit

Permalink
Add UMD header
Browse files Browse the repository at this point in the history
  • Loading branch information
sirxemic committed Aug 20, 2016
1 parent b1d7e01 commit 8e99568
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions jquery.ripples.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@
* @author sirxemic / http://sirxemic.com/
*/

+function ($) {
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
}
else if (typeof exports === 'object') {
// Node/CommonJS
factory(require('jquery'));
}
else {
// Browser globals
factory(jQuery);
}
}(function($) {

'use strict';

var gl;
var $window = $(window); // There is only one window, so why not cache the jQuery-wrapped window?
Expand All @@ -22,8 +37,7 @@

var supportsWebGL = hasWebGLSupport();

function createProgram(vertexSource, fragmentSource, uniformValues)
{
function createProgram(vertexSource, fragmentSource, uniformValues) {
function compileSource(type, source) {
var shader = gl.createShader(type);
gl.shaderSource(shader, source);
Expand Down Expand Up @@ -745,4 +759,4 @@
return this;
};

}(window.jQuery);
}));

0 comments on commit 8e99568

Please sign in to comment.