Skip to content

Commit 48d1c6b

Browse files
chore: private -> #
1 parent 57acbff commit 48d1c6b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/inbox.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ const TEMPLATE_WORKSPACE_OUT_OF_MEMORY = "a9d027b4-ac49-4fb1-9f6d-45af15f64e7a"
1313
const TEMPLATE_WORKSPACE_OUT_OF_DISK = "f047f6a3-5713-40f7-85aa-0394cce9fa3a"
1414

1515
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
1919

2020
constructor(workspace: Workspace, httpAgent: ProxyAgent, restClient: Api, storage: Storage) {
21-
this.storage = storage
21+
this.#storage = storage
2222

2323
const baseUrlRaw = restClient.getAxiosInstance().defaults.baseURL
2424
if (!baseUrlRaw) {
@@ -36,7 +36,7 @@ export class Inbox implements vscode.Disposable {
3636
const socketUrl = `${socketProto}//${baseUrl.host}/api/v2/notifications/inbox/watch?templates=${watchTemplatesParam}&targets=${watchTargetsParam}`
3737

3838
const coderSessionTokenHeader = "Coder-Session-Token"
39-
this.socket = new WebSocket(new URL(socketUrl), {
39+
this.#socket = new WebSocket(new URL(socketUrl), {
4040
followRedirects: true,
4141
agent: httpAgent,
4242
headers: {
@@ -46,15 +46,15 @@ export class Inbox implements vscode.Disposable {
4646
},
4747
})
4848

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")
5151
})
5252

53-
this.socket.on("error", (error) => {
53+
this.#socket.on("error", (error) => {
5454
this.notifyError(error)
5555
})
5656

57-
this.socket.on("message", (data) => {
57+
this.#socket.on("message", (data) => {
5858
try {
5959
const inboxMessage = JSON.parse(data.toString()) as GetInboxNotificationResponse
6060

@@ -66,15 +66,15 @@ export class Inbox implements vscode.Disposable {
6666
}
6767

6868
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
7373
}
7474
}
7575

7676
private notifyError(error: unknown) {
7777
const message = errToStr(error, "Got empty error while monitoring Coder Inbox")
78-
this.storage.writeToCoderOutputChannel(message)
78+
this.#storage.writeToCoderOutputChannel(message)
7979
}
8080
}

0 commit comments

Comments
 (0)