Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions packages/api/src/EmbeddedChatApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
ApiError,
} from "@embeddedchat/auth";

// mutliple typing status can come at the same time they should be processed in order.
let typingHandlerLock = 0;
export default class EmbeddedChatApi {
host: string;
rid: string;
Expand Down Expand Up @@ -358,13 +356,6 @@ export default class EmbeddedChatApi {
typingUser: string;
isTyping: boolean;
}) {
// don't wait for more than 2 seconds. Though in practical, the waiting time is insignificant.
setTimeout(() => {
typingHandlerLock = 0;
}, 2000);
// eslint-disable-next-line no-empty
while (typingHandlerLock) {}
typingHandlerLock = 1;
// move user to front if typing else remove it.
const idx = this.typingUsers.indexOf(typingUser);
if (idx !== -1) {
Expand All @@ -373,7 +364,6 @@ export default class EmbeddedChatApi {
if (isTyping) {
this.typingUsers.unshift(typingUser);
}
typingHandlerLock = 0;
const newTypingStatus = cloneArray(this.typingUsers);
this.onTypingStatusCallbacks.forEach((callback) =>
callback(newTypingStatus)
Expand Down