@@ -43,63 +43,63 @@ export interface EventBuffer {
43
43
}
44
44
45
45
class EventBufferArray implements EventBuffer {
46
- private events : RecordingEvent [ ] ;
46
+ private _events : RecordingEvent [ ] ;
47
47
48
48
public constructor ( ) {
49
- this . events = [ ] ;
49
+ this . _events = [ ] ;
50
50
}
51
51
52
52
public destroy ( ) : void {
53
- this . events = [ ] ;
53
+ this . _events = [ ] ;
54
54
}
55
55
56
56
public get length ( ) : number {
57
- return this . events . length ;
57
+ return this . _events . length ;
58
58
}
59
59
60
60
public addEvent ( event : RecordingEvent , isCheckout ?: boolean ) : void {
61
61
if ( isCheckout ) {
62
- this . events = [ event ] ;
62
+ this . _events = [ event ] ;
63
63
return ;
64
64
}
65
65
66
- this . events . push ( event ) ;
66
+ this . _events . push ( event ) ;
67
67
}
68
68
69
69
public finish ( ) : Promise < string > {
70
70
return new Promise < string > ( resolve => {
71
71
// Make a copy of the events array reference and immediately clear the
72
72
// events member so that we do not lose new events while uploading
73
73
// attachment.
74
- const eventsRet = this . events ;
75
- this . events = [ ] ;
74
+ const eventsRet = this . _events ;
75
+ this . _events = [ ] ;
76
76
resolve ( JSON . stringify ( eventsRet ) ) ;
77
77
} ) ;
78
78
}
79
79
}
80
80
81
81
// exporting for testing
82
82
export class EventBufferCompressionWorker implements EventBuffer {
83
- private worker : null | Worker ;
84
- private eventBufferItemLength : number = 0 ;
85
- private id : number = 0 ;
83
+ private _worker : null | Worker ;
84
+ private _eventBufferItemLength : number = 0 ;
85
+ private _id : number = 0 ;
86
86
87
87
public constructor ( worker : Worker ) {
88
- this . worker = worker ;
88
+ this . _worker = worker ;
89
89
}
90
90
91
91
public destroy ( ) : void {
92
92
__DEBUG_BUILD__ && logger . log ( '[Replay] Destroying compression worker' ) ;
93
- this . worker ?. terminate ( ) ;
94
- this . worker = null ;
93
+ this . _worker ?. terminate ( ) ;
94
+ this . _worker = null ;
95
95
}
96
96
97
97
/**
98
98
* Note that this may not reflect what is actually in the event buffer. This
99
99
* is only a local count of the buffer size since `addEvent` is async.
100
100
*/
101
101
public get length ( ) : number {
102
- return this . eventBufferItemLength ;
102
+ return this . _eventBufferItemLength ;
103
103
}
104
104
105
105
public async addEvent ( event : RecordingEvent , isCheckout ?: boolean ) : Promise < string | Uint8Array > {
@@ -138,7 +138,7 @@ export class EventBufferCompressionWorker implements EventBuffer {
138
138
}
139
139
140
140
// At this point, we'll always want to remove listener regardless of result status
141
- this . worker ?. removeEventListener ( 'message' , listener ) ;
141
+ this . _worker ?. removeEventListener ( 'message' , listener ) ;
142
142
143
143
if ( ! data . success ) {
144
144
// TODO: Do some error handling, not sure what
@@ -161,8 +161,8 @@ export class EventBufferCompressionWorker implements EventBuffer {
161
161
162
162
// Note: we can't use `once` option because it's possible it needs to
163
163
// listen to multiple messages
164
- this . worker ?. addEventListener ( 'message' , listener ) ;
165
- this . worker ?. postMessage ( { id, method, args : stringifiedArgs } ) ;
164
+ this . _worker ?. addEventListener ( 'message' , listener ) ;
165
+ this . _worker ?. postMessage ( { id, method, args : stringifiedArgs } ) ;
166
166
} ) ;
167
167
}
168
168
@@ -174,7 +174,7 @@ export class EventBufferCompressionWorker implements EventBuffer {
174
174
} ) ;
175
175
176
176
// XXX: See note in `get length()`
177
- this . eventBufferItemLength ++ ;
177
+ this . _eventBufferItemLength ++ ;
178
178
179
179
return promise ;
180
180
}
@@ -183,12 +183,12 @@ export class EventBufferCompressionWorker implements EventBuffer {
183
183
const promise = this . _postMessage ( { id, method : 'finish' , args : [ ] } ) ;
184
184
185
185
// XXX: See note in `get length()`
186
- this . eventBufferItemLength = 0 ;
186
+ this . _eventBufferItemLength = 0 ;
187
187
188
188
return promise as Promise < Uint8Array > ;
189
189
}
190
190
191
191
private _getAndIncrementId ( ) : number {
192
- return this . id ++ ;
192
+ return this . _id ++ ;
193
193
}
194
194
}
0 commit comments