You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
662 B

  1. /**
  2. * Copyright (c) 2013-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @providesModule performanceNow
  8. * @typechecks
  9. */
  10. var performance = require('./performance');
  11. var performanceNow;
  12. /**
  13. * Detect if we can use `window.performance.now()` and gracefully fallback to
  14. * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
  15. * because of Facebook's testing infrastructure.
  16. */
  17. if (performance.now) {
  18. performanceNow = () => performance.now();
  19. } else {
  20. performanceNow = () => Date.now();
  21. }
  22. module.exports = performanceNow;