forked from angular/angular.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($$RAFProvider): check for webkitCancelRequestAnimationFrame.
Android 4.3 only supports webkitCancelRequestAnimationFrame. Closes angular#6526
- Loading branch information
Showing
2 changed files
with
42 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
'use strict'; | ||
|
||
function $$RAFProvider(){ //rAF | ||
this.$get = ['$window', function($window) { | ||
var requestAnimationFrame = $window.requestAnimationFrame || | ||
$window.webkitRequestAnimationFrame; | ||
function createRAF($window) { | ||
var requestAnimationFrame = $window.requestAnimationFrame || | ||
$window.webkitRequestAnimationFrame; | ||
|
||
var cancelAnimationFrame = $window.cancelAnimationFrame || | ||
$window.webkitCancelAnimationFrame; | ||
var cancelAnimationFrame = $window.cancelAnimationFrame || | ||
$window.webkitCancelAnimationFrame || | ||
$window.webkitCancelRequestAnimationFrame; | ||
|
||
var raf = function(fn) { | ||
var id = requestAnimationFrame(fn); | ||
return function() { | ||
cancelAnimationFrame(id); | ||
}; | ||
var raf = function(fn) { | ||
var id = requestAnimationFrame(fn); | ||
return function() { | ||
cancelAnimationFrame(id); | ||
}; | ||
}; | ||
|
||
raf.supported = !!requestAnimationFrame; | ||
|
||
raf.supported = !!requestAnimationFrame; | ||
return raf; | ||
} | ||
|
||
return raf; | ||
function $$RAFProvider(){ //rAF | ||
this.$get = ['$window', function($window) { | ||
return createRAF($window); | ||
}]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d324c9e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be merged with another patch for old Firefox versions.
https://github.com/thomasbelin4/angular.js/blob/42de3e7ed28880f9fc89654419a2df21a2e9f2a9/src/ng/raf.js