Skip to content

Commit deb52c5

Browse files
authored
Change all octothorpes # to _ since private # is only >=ES2022 (#1319)
1 parent 11ead37 commit deb52c5

File tree

4 files changed

+58
-58
lines changed

4 files changed

+58
-58
lines changed

src/browser/replay/recorder.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import hrtime from '../../tracing/hrtime.js';
55
import logger from '../logger.js';
66

77
export default class Recorder {
8-
#options;
9-
#rrwebOptions;
10-
#stopFn = null;
11-
#recordFn;
12-
#events = {
8+
_options;
9+
_rrwebOptions;
10+
_stopFn = null;
11+
_recordFn;
12+
_events = {
1313
previous: [],
1414
current: [],
1515
};
@@ -26,15 +26,15 @@ export default class Recorder {
2626
}
2727

2828
this.options = options;
29-
this.#recordFn = recordFn;
29+
this._recordFn = recordFn;
3030
}
3131

3232
get isRecording() {
33-
return this.#stopFn !== null;
33+
return this._stopFn !== null;
3434
}
3535

3636
get options() {
37-
return this.#options;
37+
return this._options;
3838
}
3939

4040
set options(newOptions) {
@@ -57,8 +57,8 @@ export default class Recorder {
5757
// rrweb options
5858
...rrwebOptions
5959
} = newOptions;
60-
this.#options = { enabled, autoStart, maxSeconds, triggers, debug };
61-
this.#rrwebOptions = rrwebOptions;
60+
this._options = { enabled, autoStart, maxSeconds, triggers, debug };
61+
this._rrwebOptions = rrwebOptions;
6262

6363
if (this.isRecording && newOptions.enabled === false) {
6464
this.stop();
@@ -83,7 +83,7 @@ export default class Recorder {
8383
* @returns {Object|null} A formatted payload containing spans data in OTLP format, or null if no events exist
8484
*/
8585
dump(tracing, replayId, occurrenceUuid) {
86-
const events = this.#events.previous.concat(this.#events.current);
86+
const events = this._events.previous.concat(this._events.current);
8787

8888
if (events.length < 2) {
8989
logger.error('Replay recording cannot have less than 2 events');
@@ -132,18 +132,18 @@ export default class Recorder {
132132

133133
this.clear();
134134

135-
this.#stopFn = this.#recordFn({
135+
this._stopFn = this._recordFn({
136136
emit: (event, isCheckout) => {
137137
if (this.options.debug?.logEmits) {
138138
this._logEvent(event, isCheckout);
139139
}
140140

141141
if (isCheckout && event.type === EventType.Meta) {
142-
this.#events.previous = this.#events.current;
143-
this.#events.current = [];
142+
this._events.previous = this._events.current;
143+
this._events.current = [];
144144
}
145145

146-
this.#events.current.push(event);
146+
this._events.current.push(event);
147147
},
148148
checkoutEveryNms: this.checkoutEveryNms(),
149149
errorHandler: (error) => {
@@ -152,7 +152,7 @@ export default class Recorder {
152152
}
153153
return true; // swallow the error instead of throwing it to the window
154154
},
155-
...this.#rrwebOptions,
155+
...this._rrwebOptions,
156156
});
157157

158158
return this;
@@ -163,14 +163,14 @@ export default class Recorder {
163163
return;
164164
}
165165

166-
this.#stopFn();
167-
this.#stopFn = null;
166+
this._stopFn();
167+
this._stopFn = null;
168168

169169
return this;
170170
}
171171

172172
clear() {
173-
this.#events = {
173+
this._events = {
174174
previous: [],
175175
current: [],
176176
};

src/browser/replay/replayManager.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import logger from '../logger.js';
77
* are dumped and when they are eventually sent to the backend.
88
*/
99
export default class ReplayManager {
10-
#map;
11-
#recorder;
12-
#api;
13-
#tracing;
14-
#telemeter;
10+
_map;
11+
_recorder;
12+
_api;
13+
_tracing;
14+
_telemeter;
1515

1616
/**
1717
* Creates a new ReplayManager instance
@@ -34,11 +34,11 @@ export default class ReplayManager {
3434
throw new TypeError("Expected 'tracing' to be provided");
3535
}
3636

37-
this.#map = new Map();
38-
this.#recorder = recorder;
39-
this.#api = api;
40-
this.#tracing = tracing;
41-
this.#telemeter = telemeter;
37+
this._map = new Map();
38+
this._recorder = recorder;
39+
this._api = api;
40+
this._tracing = tracing;
41+
this._telemeter = telemeter;
4242
}
4343

4444
/**
@@ -53,19 +53,19 @@ export default class ReplayManager {
5353
*/
5454
async _processReplay(replayId, occurrenceUuid) {
5555
try {
56-
this.#telemeter?.exportTelemetrySpan({ 'rollbar.replay.id': replayId });
56+
this._telemeter?.exportTelemetrySpan({ 'rollbar.replay.id': replayId });
5757

58-
const payload = this.#recorder.dump(
59-
this.#tracing,
58+
const payload = this._recorder.dump(
59+
this._tracing,
6060
replayId,
6161
occurrenceUuid,
6262
);
6363

64-
this.#map.set(replayId, payload);
64+
this._map.set(replayId, payload);
6565
} catch (transformError) {
6666
logger.error('Error transforming spans:', transformError);
6767

68-
this.#map.set(replayId, null); // TODO(matux): Error span?
68+
this._map.set(replayId, null); // TODO(matux): Error span?
6969
}
7070

7171
return replayId;
@@ -107,15 +107,15 @@ export default class ReplayManager {
107107
return false;
108108
}
109109

110-
if (!this.#map.has(replayId)) {
110+
if (!this._map.has(replayId)) {
111111
logger.error(
112112
`ReplayManager.send: No replay found for replayId: ${replayId}`,
113113
);
114114
return false;
115115
}
116116

117-
const payload = this.#map.get(replayId);
118-
this.#map.delete(replayId);
117+
const payload = this._map.get(replayId);
118+
this._map.delete(replayId);
119119

120120
// Check if payload is empty (could be raw spans array or OTLP payload)
121121
const isEmpty =
@@ -131,7 +131,7 @@ export default class ReplayManager {
131131
}
132132

133133
try {
134-
await this.#api.postSpans(payload, { 'X-Rollbar-Replay-Id': replayId });
134+
await this._api.postSpans(payload, { 'X-Rollbar-Replay-Id': replayId });
135135
return true;
136136
} catch (error) {
137137
logger.error('Error sending replay:', error);
@@ -152,14 +152,14 @@ export default class ReplayManager {
152152
return false;
153153
}
154154

155-
if (!this.#map.has(replayId)) {
155+
if (!this._map.has(replayId)) {
156156
logger.error(
157157
`ReplayManager.discard: No replay found for replayId: ${replayId}`,
158158
);
159159
return false;
160160
}
161161

162-
this.#map.delete(replayId);
162+
this._map.delete(replayId);
163163
return true;
164164
}
165165

@@ -170,7 +170,7 @@ export default class ReplayManager {
170170
* @returns {Array|null} The spans array or null if not found
171171
*/
172172
getSpans(replayId) {
173-
return this.#map.get(replayId) ?? null;
173+
return this._map.get(replayId) ?? null;
174174
}
175175

176176
/**
@@ -180,7 +180,7 @@ export default class ReplayManager {
180180
* @param {Array} spans - The spans to set
181181
*/
182182
setSpans(replayId, spans) {
183-
this.#map.set(replayId, spans);
183+
this._map.set(replayId, spans);
184184
}
185185

186186
/**
@@ -189,13 +189,13 @@ export default class ReplayManager {
189189
* @returns {number} The number of replays currently stored
190190
*/
191191
get size() {
192-
return this.#map.size;
192+
return this._map.size;
193193
}
194194

195195
/**
196196
* Clears all stored replays without sending them
197197
*/
198198
clear() {
199-
this.#map.clear();
199+
this._map.clear();
200200
}
201201
}

src/telemetry.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ class Telemeter {
273273
value,
274274
endTimeUnixNano: fromMillis(timestamp),
275275
};
276-
const event = this.#getRepeatedEvent(name, otelAttributes);
276+
const event = this._getRepeatedEvent(name, otelAttributes);
277277
if (event) {
278-
return this.#updateRepeatedEvent(event, otelAttributes, timestamp);
278+
return this._updateRepeatedEvent(event, otelAttributes, timestamp);
279279
}
280280

281281
this.telemetrySpan?.addEvent(
@@ -312,9 +312,9 @@ class Telemeter {
312312
element,
313313
endTimeUnixNano: fromMillis(timestamp),
314314
};
315-
const event = this.#getRepeatedEvent(name, otelAttributes);
315+
const event = this._getRepeatedEvent(name, otelAttributes);
316316
if (event) {
317-
return this.#updateRepeatedEvent(event, otelAttributes, timestamp);
317+
return this._updateRepeatedEvent(event, otelAttributes, timestamp);
318318
}
319319

320320
this.telemetrySpan?.addEvent(
@@ -333,15 +333,15 @@ class Telemeter {
333333
);
334334
}
335335

336-
#getRepeatedEvent(name, attributes) {
337-
const lastEvent = this.#lastEvent(this.queue);
336+
_getRepeatedEvent(name, attributes) {
337+
const lastEvent = this._lastEvent(this.queue);
338338

339339
if (lastEvent && lastEvent.body.type === name && lastEvent.otelAttributes.target === attributes.target) {
340340
return lastEvent;
341341
}
342342
}
343343

344-
#updateRepeatedEvent(event, attributes, timestamp) {
344+
_updateRepeatedEvent(event, attributes, timestamp) {
345345
const duration = Math.max(timestamp - event.timestamp_ms, 1);
346346
event.body.value = attributes.value;
347347
event.otelAttributes.value = attributes.value;
@@ -354,7 +354,7 @@ class Telemeter {
354354
event.otelAttributes.ratio = event.otelAttributes.count / (duration / 1000);
355355
}
356356

357-
#lastEvent(list) {
357+
_lastEvent(list) {
358358
return list.length > 0 ? list[list.length - 1] : null;
359359
}
360360

@@ -416,9 +416,9 @@ class Telemeter {
416416
textZoomRatio,
417417
};
418418

419-
const event = this.#getRepeatedEvent(name, otelAttributes);
419+
const event = this._getRepeatedEvent(name, otelAttributes);
420420
if (event) {
421-
return this.#updateRepeatedEvent(event, otelAttributes, timestamp);
421+
return this._updateRepeatedEvent(event, otelAttributes, timestamp);
422422
}
423423

424424
this.telemetrySpan?.addEvent(

src/tracing/session.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import id from './id.js';
33
const SESSION_KEY = 'RollbarSession';
44

55
export class Session {
6-
#attributes;
6+
_attributes;
77

88
constructor(tracing, options) {
99
this.options = options;
1010
this.tracing = tracing;
1111
this.window = tracing.window;
1212
this.session = null;
13-
this.#attributes = {};
13+
this._attributes = {};
1414
}
1515

1616
init() {
@@ -56,11 +56,11 @@ export class Session {
5656
}
5757

5858
get attributes() {
59-
return this.#attributes;
59+
return this._attributes;
6060
}
6161

6262
setAttributes(attributes) {
63-
this.#attributes = { ...this.#attributes, ...attributes };
63+
this._attributes = { ...this._attributes, ...attributes };
6464
return this;
6565
}
6666
}

0 commit comments

Comments
 (0)