Home / File/ requestAnimationFramePolyfill.js — react Source File

requestAnimationFramePolyfill.js — react Source File

Architecture documentation for requestAnimationFramePolyfill.js, a javascript file in the react codebase. 0 imports, 1 dependents.

File javascript BabelCompiler Validation 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  8e5924d1_0e09_cb3a_3f9c_59742b66e097["requestAnimationFramePolyfill.js"]
  b5e42467_7633_e234_1d51_a93bfc4818c7["index.js"]
  b5e42467_7633_e234_1d51_a93bfc4818c7 --> 8e5924d1_0e09_cb3a_3f9c_59742b66e097
  style 8e5924d1_0e09_cb3a_3f9c_59742b66e097 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// rAF never fires on devtools_page (because it's in the background)
// https://bugs.chromium.org/p/chromium/issues/detail?id=1241986#c31
// Since we render React elements here, we need to polyfill it with setTimeout
// The polyfill is based on https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
const FRAME_TIME = 16;
let lastTime = 0;

window.requestAnimationFrame = function (callback, element) {
  const now = window.performance.now();
  const nextTime = Math.max(lastTime + FRAME_TIME, now);

  return setTimeout(function () {
    callback((lastTime = nextTime));
  }, nextTime - now);
};

window.cancelAnimationFrame = clearTimeout;

Domain

Subdomains

Functions

Frequently Asked Questions

What does requestAnimationFramePolyfill.js do?
requestAnimationFramePolyfill.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in requestAnimationFramePolyfill.js?
requestAnimationFramePolyfill.js defines 1 function(s): window.
What files import requestAnimationFramePolyfill.js?
requestAnimationFramePolyfill.js is imported by 1 file(s): index.js.
Where is requestAnimationFramePolyfill.js in the architecture?
requestAnimationFramePolyfill.js is located at packages/react-devtools-extensions/src/main/requestAnimationFramePolyfill.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-extensions/src/main).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free