Skip to content

Commit 04ed8ef

Browse files
author
Bjornskjald
committed
Changed arrow functions to methods
1 parent 659ffb4 commit 04ed8ef

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Client.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,29 +140,29 @@ export default class Client extends (EventEmitter as { new(): ClientEmitter }) {
140140
* Indicate that the user is currently present in the conversation.
141141
* Only relevant for non-group conversations
142142
*/
143-
sendPresenceState = async (recipientUserId: string, present: boolean) => {
143+
async sendPresenceState (recipientUserId: string, present: boolean) {
144144
const payload = new Payloads.PresenceState(recipientUserId, present)
145-
this.mqttApi.sendPublish(payload.getTopic(), await Payloads.encodePayload(payload))
145+
return this.mqttApi.sendPublish(payload.getTopic(), await Payloads.encodePayload(payload))
146146
}
147147

148148
/**
149149
* Send "User is typing" message.
150150
* In a non-group conversation, sendPresenceState() must be called first.
151151
*/
152-
sendTypingState = async (threadOrRecipientUserId: string, present: boolean) => {
152+
async sendTypingState (threadOrRecipientUserId: string, present: boolean) {
153153
const payload = new Payloads.TypingState(this.session.tokens.uid, present, threadOrRecipientUserId)
154-
this.mqttApi.sendPublish(payload.getTopic(), await Payloads.encodePayload(payload))
154+
return this.mqttApi.sendPublish(payload.getTopic(), await Payloads.encodePayload(payload))
155155
}
156156

157157
/**
158158
* Mark a message as read.
159159
*/
160-
sendReadReceipt = async (message: Message) => {
160+
async sendReadReceipt (message: Message) {
161161
const payload = new Payloads.ReadReceipt(message)
162-
this.mqttApi.sendPublish(payload.getTopic(), await Payloads.encodePayload(payload))
162+
return this.mqttApi.sendPublish(payload.getTopic(), await Payloads.encodePayload(payload))
163163
}
164164

165-
getThreadList = async (count: number): Promise<Thread[]> => {
165+
async getThreadList (count: number): Promise<Thread[]> {
166166
const threads = await this.httpApi.threadListQuery(count)
167167
return threads.viewer.message_threads.nodes.map(parseThread)
168168
}

src/mqtt/MqttApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default class MqttApi extends EventEmitter {
5555
this.connection.on('close', () => this.reconnect())
5656
}
5757

58-
reconnect = async () => {
58+
async reconnect () {
5959
debugLog('reconnecting...')
6060
await this.connection.connect()
6161
await this.sendConnectMessage()
@@ -173,7 +173,7 @@ export default class MqttApi extends EventEmitter {
173173
return this.connection.writeMessage(message)
174174
}
175175

176-
parsePacket = async (packet: MqttPacket) => {
176+
async parsePacket (packet: MqttPacket) {
177177
switch (packet.type) {
178178
case MessageType.ConnectAck:
179179
debugLog('Packet type: ConnectAck')

0 commit comments

Comments
 (0)