Skip to content

Commit 844cd0f

Browse files
committed
convert private setup flag in BrowserTracing to closure variable
1 parent fc371fe commit 844cd0f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/tracing/src/browser/browsertracing.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ const DEFAULT_BROWSER_TRACING_OPTIONS = {
101101
...defaultRequestInstrumentationOptions,
102102
};
103103

104+
let emitOptionsWarning = false;
105+
104106
/**
105107
* The Browser Tracing integration automatically instruments browser pageload/navigation
106108
* actions as transactions, and captures requests, metrics and errors as spans.
@@ -126,8 +128,6 @@ export class BrowserTracing implements Integration {
126128

127129
private readonly _metrics: MetricsInstrumentation;
128130

129-
private readonly _emitOptionsWarning: boolean = false;
130-
131131
/** Store configured idle timeout so that it can be added as a tag to transactions */
132132
private _configuredIdleTimeout: BrowserTracingOptions['idleTimeout'] | undefined = undefined;
133133

@@ -139,7 +139,7 @@ export class BrowserTracing implements Integration {
139139
if (_options.tracingOrigins && Array.isArray(_options.tracingOrigins) && _options.tracingOrigins.length !== 0) {
140140
tracingOrigins = _options.tracingOrigins;
141141
} else {
142-
isDebugBuild() && (this._emitOptionsWarning = true);
142+
isDebugBuild() && (emitOptionsWarning = true);
143143
}
144144
}
145145

@@ -159,7 +159,7 @@ export class BrowserTracing implements Integration {
159159
public setupOnce(_: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {
160160
this._getCurrentHub = getCurrentHub;
161161

162-
if (this._emitOptionsWarning) {
162+
if (emitOptionsWarning) {
163163
isDebugBuild() &&
164164
logger.warn(
165165
'[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace.',

0 commit comments

Comments
 (0)