Skip to content

Commit

Permalink
Remove import cycle from Systrace module
Browse files Browse the repository at this point in the history
Summary:
Replaced import cycle with Flow type cycle, which will remove the warnings from Metro.

Changelog: [internal]

Reviewed By: motiz88

Differential Revision: D40177136

fbshipit-source-id: e63986d8918e48e8c4cd8014d306d68fcbd2cf10
  • Loading branch information
rubennorte authored and facebook-github-bot committed Oct 7, 2022
1 parent ae3dd54 commit 21dc5c8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Libraries/Performance/Systrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @format
*/

import * as Systrace from './Systrace';
import typeof * as SystraceModule from './Systrace';

const TRACE_TAG_REACT_APPS = 1 << 17; // eslint-disable-line no-bitwise

Expand Down Expand Up @@ -123,6 +123,16 @@ export function counterEvent(eventName: EventName, value: number): void {
}

if (__DEV__) {
const Systrace: SystraceModule = {
isEnabled,
setEnabled,
beginEvent,
endEvent,
beginAsyncEvent,
endAsyncEvent,
counterEvent,
};

// The metro require polyfill can not have dependencies (true for all polyfills).
// Ensure that `Systrace` is available in polyfill by exposing it globally.
global[(global.__METRO_GLOBAL_PREFIX__ || '') + '__SYSTRACE'] = Systrace;
Expand Down

0 comments on commit 21dc5c8

Please sign in to comment.