Skip to content

Commit

Permalink
Merge pull request #27022 from software-mansion-labs/ts-migration/Met…
Browse files Browse the repository at this point in the history
…rics

[No QA][TS migration] Migrate 'Metrics' lib to TypeScript
  • Loading branch information
jasperhuangg authored Sep 12, 2023
2 parents ec75ffc + b023871 commit 3fe7ab1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
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};

0 comments on commit 3fe7ab1

Please sign in to comment.