Skip to content

Commit

Permalink
Attempt fixing facebook#9102. Fake polyfill rAF
Browse files Browse the repository at this point in the history
  • Loading branch information
ManasJayanth committed Apr 18, 2017
1 parent 10eaf26 commit 1a459cc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/renderers/shared/ReactDOMFrameScheduling.js
Expand Up @@ -23,16 +23,22 @@
import type {Deadline} from 'ReactFiberReconciler';

var invariant = require('fbjs/lib/invariant');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');

// TODO: There's no way to cancel these, because Fiber doesn't atm.
let rAF: (callback: (time: number) => void) => number;
let rIC: (callback: (deadline: Deadline) => void) => number;
if (typeof requestAnimationFrame !== 'function') {
invariant(
false,
'React depends on requestAnimationFrame. Make sure that you load a ' +
if (ExecutionEnvironment.canUseDOM) {
invariant(
false,
'React depends on requestAnimationFrame. Make sure that you load a ' +
'polyfill in older browsers.',
);
);
} else {
global.window = global;
window.requestAnimationFrame = frameCallback => setTimeout(frameCallback, 16); //Good enough for a fake polyfill?
}
} else if (typeof requestIdleCallback !== 'function') {
// Wrap requestAnimationFrame and polyfill requestIdleCallback.

Expand Down

0 comments on commit 1a459cc

Please sign in to comment.