Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81155 views
1
/**
2
* Copyright 2013-2014, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @providesModule performanceNow
10
* @typechecks
11
*/
12
13
var performance = require('performance');
14
15
/**
16
* Detect if we can use `window.performance.now()` and gracefully fallback to
17
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
18
* because of Facebook's testing infrastructure.
19
*/
20
if (!performance || !performance.now) {
21
performance = Date;
22
}
23
24
var performanceNow = performance.now.bind(performance);
25
26
module.exports = performanceNow;
27
28