Skip to content

Commit 0b82fcc

Browse files
committed
Merge pull request #15 from jantimon/master
Browserify support
2 parents 839e876 + c18726d commit 0b82fcc

File tree

5 files changed

+32
-13
lines changed

5 files changed

+32
-13
lines changed

dist/jquery.requestAnimationFrame.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
/*! jQuery requestAnimationFrame - v0.1.3pre - 2014-02-07
1+
/*! jQuery requestAnimationFrame - v0.1.3pre - 2015-04-27
22
* https://github.com/gnarf37/jquery-requestAnimationFrame
3-
* Copyright (c) 2014 Corey Frang; Licensed MIT */
3+
* Copyright (c) 2015 Corey Frang; Licensed MIT */
44

5-
(function( jQuery ) {
5+
// UMD factory https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
6+
(function (factory) {
7+
if (typeof define === 'function' && define.amd) {
8+
// AMD. Register as an anonymous module.
9+
define(['jquery'], factory);
10+
} else {
11+
// Browser globals
12+
factory(jQuery);
13+
}
14+
}(function (jQuery) {
615

716
// requestAnimationFrame polyfill adapted from Erik Möller
817
// fixes from Paul Irish and Tino Zijdel
@@ -62,4 +71,4 @@ if ( requestAnimationFrame ) {
6271

6372
}
6473

65-
}( jQuery ));
74+
}));

dist/jquery.requestAnimationFrame.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

grunt.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ module.exports = function(grunt) {
4848
browser: true
4949
},
5050
globals: {
51-
jQuery: true
51+
jQuery: true,
52+
define: true
5253
}
5354
},
5455
uglify: {}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"title": "jQuery requestAnimationFrame",
44
"description": "Replaces the standard jQuery timer loop with requestAnimationFrame where supported. Requires jQuery 1.8",
55
"version": "0.1.3pre",
6+
"main": "dist/jquery.requestAnimationFrame.js",
67
"homepage": "https://github.com/gnarf37/jquery-requestAnimationFrame",
78
"author": {
89
"name": "Corey Frang",

src/jquery.requestAnimationFrame.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@
66
* Copyright (c) 2012 Corey Frang
77
* Licensed under the MIT license.
88
*/
9-
10-
(function( jQuery ) {
9+
// UMD factory https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
10+
(function (factory) {
11+
if (typeof define === 'function' && define.amd) {
12+
// AMD. Register as an anonymous module.
13+
define(['jquery'], factory);
14+
} else {
15+
// Browser globals
16+
factory(jQuery);
17+
}
18+
}(function (jQuery) {
1119

1220
// requestAnimationFrame polyfill adapted from Erik Möller
1321
// fixes from Paul Irish and Tino Zijdel
@@ -24,7 +32,7 @@ var animating,
2432
for(; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {
2533
requestAnimationFrame = window[ vendors[lastTime] + "RequestAnimationFrame" ];
2634
cancelAnimationFrame = cancelAnimationFrame ||
27-
window[ vendors[lastTime] + "CancelAnimationFrame" ] ||
35+
window[ vendors[lastTime] + "CancelAnimationFrame" ] ||
2836
window[ vendors[lastTime] + "CancelRequestAnimationFrame" ];
2937
}
3038

@@ -64,7 +72,7 @@ if ( requestAnimationFrame ) {
6472
window.cancelAnimationFrame = function(id) {
6573
clearTimeout(id);
6674
};
67-
75+
6876
}
6977

70-
}( jQuery ));
78+
}));

0 commit comments

Comments
 (0)