Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA][TS migration] Migrate 'Metrics' lib to TypeScript #27022

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/libs/Metrics/index.js

This file was deleted.

17 changes: 0 additions & 17 deletions src/libs/Metrics/index.native.js

This file was deleted.

14 changes: 14 additions & 0 deletions src/libs/Metrics/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import CONFIG from '../../CONFIG';
import {CanCaptureOnyxMetrics, CanCapturePerformanceMetrics} from './types';

/**
* Is capturing performance stats enabled.
*/
const canCapturePerformanceMetrics: CanCapturePerformanceMetrics = () => CONFIG.CAPTURE_METRICS;

/**
* Is capturing Onyx stats enabled.
*/
const canCaptureOnyxMetrics: CanCaptureOnyxMetrics = () => CONFIG.ONYX_METRICS;

export {canCapturePerformanceMetrics, canCaptureOnyxMetrics};
9 changes: 9 additions & 0 deletions src/libs/Metrics/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import CONFIG from '../../CONFIG';
import {CanCaptureOnyxMetrics, CanCapturePerformanceMetrics} from './types';

// We don't capture performance metrics on web as there are enough tools available
const canCapturePerformanceMetrics: CanCapturePerformanceMetrics = () => false;

const canCaptureOnyxMetrics: CanCaptureOnyxMetrics = () => CONFIG.ONYX_METRICS;

export {canCapturePerformanceMetrics, canCaptureOnyxMetrics};
4 changes: 4 additions & 0 deletions src/libs/Metrics/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type CanCapturePerformanceMetrics = () => boolean;
type CanCaptureOnyxMetrics = () => boolean;

export type {CanCapturePerformanceMetrics, CanCaptureOnyxMetrics};
Loading