Skip to main content

Class: SimpleChatStore<AdditionalMessageOptions>

fixme: User could carry object references in the messages. This could lead to memory leaks if the messages are not properly cleaned up.

Type parameters

NameType
AdditionalMessageOptionsextends Record<string, unknown> = Record<string, unknown>

Implements

Constructors

constructor

new SimpleChatStore<AdditionalMessageOptions>(): SimpleChatStore<AdditionalMessageOptions>

Type parameters

NameType
AdditionalMessageOptionsextends Record<string, unknown> = Record<string, unknown>

Returns

SimpleChatStore<AdditionalMessageOptions>

Properties

store

store: Object = {}

Index signature

▪ [key: string]: ChatMessage<AdditionalMessageOptions>[]

Defined in

packages/core/src/storage/chatStore/SimpleChatStore.ts:15

Methods

addMessage

addMessage(key, message): void

Parameters

NameType
keystring
messageChatMessage<AdditionalMessageOptions>

Returns

void

Implementation of

BaseChatStore.addMessage

Defined in

packages/core/src/storage/chatStore/SimpleChatStore.ts:28


deleteLastMessage

deleteLastMessage(key): null | ChatMessage<AdditionalMessageOptions>

Parameters

NameType
keystring

Returns

null | ChatMessage<AdditionalMessageOptions>

Implementation of

BaseChatStore.deleteLastMessage

Defined in

packages/core/src/storage/chatStore/SimpleChatStore.ts:55


deleteMessage

deleteMessage(key, idx): null | ChatMessage<AdditionalMessageOptions>

Parameters

NameType
keystring
idxnumber

Returns

null | ChatMessage<AdditionalMessageOptions>

Implementation of

BaseChatStore.deleteMessage

Defined in

packages/core/src/storage/chatStore/SimpleChatStore.ts:45


deleteMessages

deleteMessages(key): null | ChatMessage<AdditionalMessageOptions>[]

Parameters

NameType
keystring

Returns

null | ChatMessage<AdditionalMessageOptions>[]

Implementation of

BaseChatStore.deleteMessages

Defined in

packages/core/src/storage/chatStore/SimpleChatStore.ts:36


getKeys

getKeys(): string[]

Returns

string[]

Implementation of

BaseChatStore.getKeys

Defined in

packages/core/src/storage/chatStore/SimpleChatStore.ts:65


getMessages

getMessages(key): ChatMessage<AdditionalMessageOptions>[]

Parameters

NameType
keystring

Returns

ChatMessage<AdditionalMessageOptions>[]

Implementation of

BaseChatStore.getMessages

Defined in

packages/core/src/storage/chatStore/SimpleChatStore.ts:24


setMessages

setMessages(key, messages): void

Parameters

NameType
keystring
messagesChatMessage<AdditionalMessageOptions>[]

Returns

void

Implementation of

BaseChatStore.setMessages

Defined in

packages/core/src/storage/chatStore/SimpleChatStore.ts:17