stream-chat
Advanced tools
Comparing version 8.12.2 to 8.12.3
@@ -41,2 +41,8 @@ /// <reference types="node" /> | ||
/** | ||
* Collects the incoming WS events before the channel is marked as initialized. | ||
* This prevents executing procedures that depend on channel being initialized. | ||
* Once the channel is marked as initialized the queue is flushed. | ||
*/ | ||
wsEventQueue: Event<StreamChatGenerics>[]; | ||
/** | ||
* constructor - Create a channel | ||
@@ -521,2 +527,3 @@ * | ||
_channelURL: () => string; | ||
_isInitialized(): boolean; | ||
_checkInitialized(): void; | ||
@@ -532,3 +539,4 @@ _initializeState(state: ChannelAPIResponse<StreamChatGenerics>, messageSetToAddToIfDoesNotExist?: MessageSetType): { | ||
_disconnect(): void; | ||
_flushWsEventQueue(): void; | ||
} | ||
//# sourceMappingURL=channel.d.ts.map |
@@ -48,2 +48,25 @@ export declare const EVENT_MAP: { | ||
}; | ||
export declare const CHANNEL_HANDLED_EVENTS: { | ||
'typing.start': boolean; | ||
'typing.stop': boolean; | ||
'message.read': boolean; | ||
'user.watching.start': boolean; | ||
'user.updated': boolean; | ||
'user.watching.stop': boolean; | ||
'message.deleted': boolean; | ||
'message.new': boolean; | ||
'message.updated': boolean; | ||
'channel.truncated': boolean; | ||
'member.added': boolean; | ||
'member.updated': boolean; | ||
'member.removed': boolean; | ||
'channel.updated': boolean; | ||
'reaction.new': boolean; | ||
'reaction.deleted': boolean; | ||
'reaction.updated': boolean; | ||
'channel.hidden': boolean; | ||
'channel.visible': boolean; | ||
'user.banned': boolean; | ||
'user.unbanned': boolean; | ||
}; | ||
//# sourceMappingURL=events.d.ts.map |
{ | ||
"name": "stream-chat", | ||
"version": "8.12.2", | ||
"version": "8.12.3", | ||
"description": "JS SDK for the Stream Chat API", | ||
@@ -5,0 +5,0 @@ "author": "GetStream", |
@@ -92,2 +92,8 @@ import { ChannelState } from './channel_state'; | ||
disconnected: boolean; | ||
/** | ||
* Collects the incoming WS events before the channel is marked as initialized. | ||
* This prevents executing procedures that depend on channel being initialized. | ||
* Once the channel is marked as initialized the queue is flushed. | ||
*/ | ||
wsEventQueue: Event<StreamChatGenerics>[]; | ||
@@ -136,2 +142,3 @@ /** | ||
this.disconnected = false; | ||
this.wsEventQueue = []; | ||
} | ||
@@ -785,2 +792,3 @@ | ||
this.initialized = true; | ||
this._flushWsEventQueue(); | ||
this.data = state.channel; | ||
@@ -1213,2 +1221,8 @@ | ||
const channel = this; | ||
if (!this._isInitialized()) { | ||
this.wsEventQueue.push(event); | ||
return; | ||
} | ||
this._client.logger( | ||
@@ -1449,2 +1463,6 @@ 'info', | ||
_isInitialized() { | ||
return this.initialized || this.offlineMode || this.getClient()._isUsingServerAuth(); | ||
} | ||
_checkInitialized() { | ||
@@ -1563,2 +1581,9 @@ if (!this.initialized && !this.offlineMode && !this.getClient()._isUsingServerAuth()) { | ||
} | ||
_flushWsEventQueue() { | ||
while (this.wsEventQueue.length) { | ||
const event = this.wsEventQueue.shift(); | ||
if (event) this.getClient().dispatchEvent(event); | ||
} | ||
} | ||
} |
@@ -50,1 +50,26 @@ export const EVENT_MAP = { | ||
}; | ||
// events handled by channel._handleChannelEvent | ||
export const CHANNEL_HANDLED_EVENTS = { | ||
'typing.start': true, | ||
'typing.stop': true, | ||
'message.read': true, | ||
'user.watching.start': true, | ||
'user.updated': true, | ||
'user.watching.stop': true, | ||
'message.deleted': true, | ||
'message.new': true, | ||
'message.updated': true, | ||
'channel.truncated': true, | ||
'member.added': true, | ||
'member.updated': true, | ||
'member.removed': true, | ||
'channel.updated': true, | ||
'reaction.new': true, | ||
'reaction.deleted': true, | ||
'reaction.updated': true, | ||
'channel.hidden': true, | ||
'channel.visible': true, | ||
'user.banned': true, | ||
'user.unbanned': true, | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5027487
53152