@@ -9,31 +9,29 @@ const { URL } = require('url')
9
9
const pkg = require ( '../../../../package.json' )
10
10
11
11
class Crashtracker {
12
- constructor ( ) {
13
- this . _started = false
14
- }
12
+ #started = false
15
13
16
14
configure ( config ) {
17
- if ( ! this . _started ) return
15
+ if ( ! this . #started ) return
18
16
19
17
try {
20
- binding . updateConfig ( this . _getConfig ( config ) )
21
- binding . updateMetadata ( this . _getMetadata ( config ) )
18
+ binding . updateConfig ( this . #getConfig ( config ) )
19
+ binding . updateMetadata ( this . #getMetadata ( config ) )
22
20
} catch ( e ) {
23
21
log . error ( 'Error configuring crashtracker' , e )
24
22
}
25
23
}
26
24
27
25
start ( config ) {
28
- if ( this . _started ) return this . configure ( config )
26
+ if ( this . #started ) return this . configure ( config )
29
27
30
- this . _started = true
28
+ this . #started = true
31
29
32
30
try {
33
31
binding . init (
34
- this . _getConfig ( config ) ,
35
- this . _getReceiverConfig ( config ) ,
36
- this . _getMetadata ( config )
32
+ this . #getConfig ( config ) ,
33
+ this . #getReceiverConfig ( ) ,
34
+ this . #getMetadata ( config )
37
35
)
38
36
} catch ( e ) {
39
37
log . error ( 'Error initialising crashtracker' , e )
@@ -50,7 +48,7 @@ class Crashtracker {
50
48
}
51
49
52
50
// TODO: Send only configured values when defaults are fixed.
53
- _getConfig ( config ) {
51
+ #getConfig ( config ) {
54
52
const { hostname = '127.0.0.1' , port = 8126 } = config
55
53
const url = config . url || new URL ( `http://${ hostname } :${ port } ` )
56
54
@@ -75,7 +73,7 @@ class Crashtracker {
75
73
}
76
74
}
77
75
78
- _getMetadata ( config ) {
76
+ #getMetadata ( config ) {
79
77
const tags = Object . keys ( config . tags ) . map ( key => `${ key } :${ config . tags [ key ] } ` )
80
78
81
79
return {
@@ -94,7 +92,7 @@ class Crashtracker {
94
92
}
95
93
}
96
94
97
- _getReceiverConfig ( ) {
95
+ #getReceiverConfig ( ) {
98
96
return {
99
97
args : [ ] ,
100
98
env : [ ] ,
0 commit comments