// Inspired by https://gist.github.com/paulirish/1579671

export let requestAnimationFrame;
export let cancelAnimationFrame;

let lastTime = 0;

if(typeof window != 'undefined') {
  requestAnimationFrame = window.requestAnimationFrame;
  cancelAnimationFrame = window.cancelAnimationFrame;

  const vendors = ['ms', 'moz', 'webkit', 'o'];
  for (let x = 0; x < vendors.length && !requestAnimationFrame; ++x) {
    requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
    cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] ||
      window[vendors[x] + 'CancelRequestAnimationFrame'];
  }
}

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

if (!cancelAnimationFrame) {
  cancelAnimationFrame = (id) => {
    clearTimeout(id);
  };
}

@@ -51,16 +51,77 @@
 579671%0A%0A
+import %7B canUseDOM %7D from 'react/lib/ExecutionEnvironment';%0A%0A
 export l
@@ -205,37 +205,19 @@
 %0A%0Aif
-(typeof window != 'undefined'
+ (canUseDOM
 ) %7B%0A

switch to canUseDom