Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
chore(dep): add rAF polyfill bower dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed May 15, 2014
1 parent ab5e096 commit 1ee4bb6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 38 deletions.
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"tests"
],
"dependencies": {
"angular": "^1"
"angular": "^1",
"raf": "https://gist.githubusercontent.com/paulirish/1579671/raw/3d42a3a76ed09890434a07be2212f376959e616f/rAF.js"
},
"devDependencies": {
"angular-mocks": "^1",
Expand Down
37 changes: 0 additions & 37 deletions src/ui-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,40 +214,3 @@ angular.module('ui.layout', [])
}
};
});



/**
* http://paulirish.com/2011/requestanimationframe-for-smart-animating/
* http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
*
* requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
*
* MIT license
*/
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
window.cancelAnimationFrame =
window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
}

if (!window.requestAnimationFrame) {
window.requestAnimationFrame = function (callback) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function () {
callback(currTime + timeToCall);
},
timeToCall);
lastTime = currTime + timeToCall;
return id;
};
}

if (!window.cancelAnimationFrame) {
window.cancelAnimationFrame = function (id) {
clearTimeout(id);
};
}
1 change: 1 addition & 0 deletions test/karma-jqlite.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = function (config) {
'test/helpers/browserTrigger.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/raf/index.js',
'src/*',
'test/*.spec.js'
],
Expand Down
1 change: 1 addition & 0 deletions test/karma-jquery.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = function (config) {
'test/helpers/browserTrigger.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/raf/index.js',
'src/*',
'test/*.spec.js'
],
Expand Down

0 comments on commit 1ee4bb6

Please sign in to comment.