From 3ed7b0aa0ace288d69e0151147b30db454209d48 Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Mon, 27 Apr 2015 11:06:21 +0200 Subject: [PATCH 1/3] Add browserify/requirejs/webpack support --- dist/jquery.requestAnimationFrame.js | 17 +++++++++++++---- dist/jquery.requestAnimationFrame.min.js | 6 +++--- grunt.js | 3 ++- src/jquery.requestAnimationFrame.js | 14 +++++++++++--- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/dist/jquery.requestAnimationFrame.js b/dist/jquery.requestAnimationFrame.js index 045e70f..977bd88 100644 --- a/dist/jquery.requestAnimationFrame.js +++ b/dist/jquery.requestAnimationFrame.js @@ -1,8 +1,17 @@ -/*! jQuery requestAnimationFrame - v0.1.3pre - 2014-02-07 +/*! jQuery requestAnimationFrame - v0.1.3pre - 2015-04-27 * https://github.com/gnarf37/jquery-requestAnimationFrame -* Copyright (c) 2014 Corey Frang; Licensed MIT */ +* Copyright (c) 2015 Corey Frang; Licensed MIT */ -(function( jQuery ) { +// UMD factory https://github.com/umdjs/umd/blob/master/jqueryPlugin.js +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else { + // Browser globals + factory(jQuery); + } +}(function (jQuery) { // requestAnimationFrame polyfill adapted from Erik Möller // fixes from Paul Irish and Tino Zijdel @@ -62,4 +71,4 @@ if ( requestAnimationFrame ) { } -}( jQuery )); +})); diff --git a/dist/jquery.requestAnimationFrame.min.js b/dist/jquery.requestAnimationFrame.min.js index 3e90877..f178b52 100644 --- a/dist/jquery.requestAnimationFrame.min.js +++ b/dist/jquery.requestAnimationFrame.min.js @@ -1,4 +1,4 @@ -/*! jQuery requestAnimationFrame - v0.1.3pre - 2014-02-07 +/*! jQuery requestAnimationFrame - v0.1.3pre - 2015-04-27 * https://github.com/gnarf37/jquery-requestAnimationFrame -* Copyright (c) 2014 Corey Frang; Licensed MIT */ -(function(e){function o(){t&&(i(o),e.fx.tick())}var t,n=0,r=["webkit","moz"],i=window.requestAnimationFrame,s=window.cancelAnimationFrame;for(;n Date: Mon, 27 Apr 2015 11:15:21 +0200 Subject: [PATCH 2/3] Set main package.json entry --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index e321d5a..6476ba2 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "title": "jQuery requestAnimationFrame", "description": "Replaces the standard jQuery timer loop with requestAnimationFrame where supported. Requires jQuery 1.8", "version": "0.1.3pre", + "main": "dist/jquery.requestAnimationFrame.js", "homepage": "https://github.com/gnarf37/jquery-requestAnimationFrame", "author": { "name": "Corey Frang", From c18726db6856a4e1504426af796ebdb935727e93 Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Mon, 27 Apr 2015 11:20:19 +0200 Subject: [PATCH 3/3] Fix code style --- src/jquery.requestAnimationFrame.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jquery.requestAnimationFrame.js b/src/jquery.requestAnimationFrame.js index ecdc91e..142ad8f 100644 --- a/src/jquery.requestAnimationFrame.js +++ b/src/jquery.requestAnimationFrame.js @@ -8,13 +8,13 @@ */ // UMD factory https://github.com/umdjs/umd/blob/master/jqueryPlugin.js (function (factory) { - if (typeof define === 'function' && define.amd) { + if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); - } else { + } else { // Browser globals factory(jQuery); - } + } }(function (jQuery) { // requestAnimationFrame polyfill adapted from Erik Möller @@ -32,7 +32,7 @@ var animating, for(; lastTime < vendors.length && !requestAnimationFrame; lastTime++) { requestAnimationFrame = window[ vendors[lastTime] + "RequestAnimationFrame" ]; cancelAnimationFrame = cancelAnimationFrame || - window[ vendors[lastTime] + "CancelAnimationFrame" ] || + window[ vendors[lastTime] + "CancelAnimationFrame" ] || window[ vendors[lastTime] + "CancelRequestAnimationFrame" ]; } @@ -72,7 +72,7 @@ if ( requestAnimationFrame ) { window.cancelAnimationFrame = function(id) { clearTimeout(id); }; - + } }));