Separate performanceNow into own project
Tim Yung committed
Apr 9, 2014 at 17:49 UTC
356e85cd6ad4db66c3dceb44e12f1f8f709f1fce
2 files changed
+38
-14
src/vendor/performance/performance.js
new
+33
@@ -0,0 +1,33 @@
1
+/**
2
+ * Copyright 2013-2014 Facebook, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * @providesModule performance
17
+ * @typechecks
18
+ */
19
+
20
+"use strict";
21
+
22
+var ExecutionEnvironment = require('ExecutionEnvironment');
23
+
24
+var performance;
25
+
26
+if (ExecutionEnvironment.canUseDOM) {
27
+ performance =
28
+ window.performance ||
29
+ window.msPerformance ||
30
+ window.webkitPerformance;
31
+}
32
+
33
+module.exports = performance || {};
src/vendor/performance/performanceNow.js
renamed
+5
-14
@@ -14,25 +14,16 @@
14
* limitations under the License.
15
*
16
* @providesModule performanceNow
17
- * @typechecks static-only
17
+ * @typechecks
18
*/
19
20
-"use strict";
21
-
22
-var ExecutionEnvironment = require('ExecutionEnvironment');
20
+var performance = require('performance');
21
22
/**
25
- * Detect if we can use window.performance.now() and gracefully
26
- * fallback to Date.now() if it doesn't exist.
27
- * We need to support Firefox < 15 for now due to Facebook's webdriver
28
- * infrastructure.
23
+ * Detect if we can use `window.performance.now()` and gracefully fallback to
24
+ * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
25
+ * because of Facebook's testing infrastructure.
26
*/
30
-var performance = null;
31
-
32
-if (ExecutionEnvironment.canUseDOM) {
33
- performance = window.performance || window.webkitPerformance;
34
-}
35
-
27
if (!performance || !performance.now) {
28
performance = Date;
29
}