@@ -13,12 +13,12 @@ const TEMPLATE_WORKSPACE_OUT_OF_MEMORY = "a9d027b4-ac49-4fb1-9f6d-45af15f64e7a"
13
13
const TEMPLATE_WORKSPACE_OUT_OF_DISK = "f047f6a3-5713-40f7-85aa-0394cce9fa3a"
14
14
15
15
export class Inbox implements vscode . Disposable {
16
- private readonly storage : Storage
17
- private disposed = false
18
- private socket : WebSocket
16
+ readonly # storage: Storage
17
+ # disposed = false
18
+ # socket: WebSocket
19
19
20
20
constructor ( workspace : Workspace , httpAgent : ProxyAgent , restClient : Api , storage : Storage ) {
21
- this . storage = storage
21
+ this . # storage = storage
22
22
23
23
const baseUrlRaw = restClient . getAxiosInstance ( ) . defaults . baseURL
24
24
if ( ! baseUrlRaw ) {
@@ -36,7 +36,7 @@ export class Inbox implements vscode.Disposable {
36
36
const socketUrl = `${ socketProto } //${ baseUrl . host } /api/v2/notifications/inbox/watch?templates=${ watchTemplatesParam } &targets=${ watchTargetsParam } `
37
37
38
38
const coderSessionTokenHeader = "Coder-Session-Token"
39
- this . socket = new WebSocket ( new URL ( socketUrl ) , {
39
+ this . # socket = new WebSocket ( new URL ( socketUrl ) , {
40
40
followRedirects : true ,
41
41
agent : httpAgent ,
42
42
headers : {
@@ -46,15 +46,15 @@ export class Inbox implements vscode.Disposable {
46
46
} ,
47
47
} )
48
48
49
- this . socket . on ( "open" , ( ) => {
50
- this . storage . writeToCoderOutputChannel ( "Listening to Coder Inbox" )
49
+ this . # socket. on ( "open" , ( ) => {
50
+ this . # storage. writeToCoderOutputChannel ( "Listening to Coder Inbox" )
51
51
} )
52
52
53
- this . socket . on ( "error" , ( error ) => {
53
+ this . # socket. on ( "error" , ( error ) => {
54
54
this . notifyError ( error )
55
55
} )
56
56
57
- this . socket . on ( "message" , ( data ) => {
57
+ this . # socket. on ( "message" , ( data ) => {
58
58
try {
59
59
const inboxMessage = JSON . parse ( data . toString ( ) ) as GetInboxNotificationResponse
60
60
@@ -66,15 +66,15 @@ export class Inbox implements vscode.Disposable {
66
66
}
67
67
68
68
dispose ( ) {
69
- if ( ! this . disposed ) {
70
- this . storage . writeToCoderOutputChannel ( "No longer listening to Coder Inbox" )
71
- this . socket . close ( )
72
- this . disposed = true
69
+ if ( ! this . # disposed) {
70
+ this . # storage. writeToCoderOutputChannel ( "No longer listening to Coder Inbox" )
71
+ this . # socket. close ( )
72
+ this . # disposed = true
73
73
}
74
74
}
75
75
76
76
private notifyError ( error : unknown ) {
77
77
const message = errToStr ( error , "Got empty error while monitoring Coder Inbox" )
78
- this . storage . writeToCoderOutputChannel ( message )
78
+ this . # storage. writeToCoderOutputChannel ( message )
79
79
}
80
80
}
0 commit comments