Skip to content

Browserify support #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions dist/jquery.requestAnimationFrame.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -62,4 +71,4 @@ if ( requestAnimationFrame ) {

}

}( jQuery ));
}));
6 changes: 3 additions & 3 deletions dist/jquery.requestAnimationFrame.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ module.exports = function(grunt) {
browser: true
},
globals: {
jQuery: true
jQuery: true,
define: true
}
},
uglify: {}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 13 additions & 5 deletions src/jquery.requestAnimationFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@
* Copyright (c) 2012 Corey Frang
* Licensed under the MIT license.
*/

(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
Expand All @@ -24,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" ];
}

Expand Down Expand Up @@ -64,7 +72,7 @@ if ( requestAnimationFrame ) {
window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};

}

}( jQuery ));
}));