mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-23 21:33:47 +00:00
nodejs: add tests to library (#7694)
* nodejs: add tests to library * new tests * remove message splitting * fix race * docs * replace extract-zip with yauzl that it wraps (high severity issue) * fix ci tests * skip server tests on macos and win unless SMP_SERVER is set * fix win test * fix win test --------- Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
1 parent
ba9269a3ad
commit
46b2cf9f85
73 files changed
+957
-265
No files matched your search
@@ -0,0 +1,98 @@
|
||||
[**simplex-chat**](README.md)
|
||||
|
||||
***
|
||||
|
||||
[simplex-chat](README.md) / [api](Namespace.api.md) / LiveMessage
|
||||
|
||||
# Class: LiveMessage
|
||||
|
||||
Defined in: [src/api.ts:1005](../api.ts#L1005)
|
||||
|
||||
Text shown as a live message while it is written, e.g. a streamed reply.
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
> **new LiveMessage**(`chat`, `chatType`, `chatId`, `interval?`, `onError?`): `LiveMessage`
|
||||
|
||||
Defined in: [src/api.ts:1019](../api.ts#L1019)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### chat
|
||||
|
||||
`Pick`\<[`ChatApi`](api.Class.ChatApi.md), `"apiSendMessages"` \| `"apiUpdateChatItem"` \| `"apiDeleteChatItems"`\>
|
||||
|
||||
Chat API, or an object with its methods to send, update and delete messages.
|
||||
|
||||
##### chatType
|
||||
|
||||
`ChatType`
|
||||
|
||||
Chat type.
|
||||
|
||||
##### chatId
|
||||
|
||||
`number`
|
||||
|
||||
Contact or group ID.
|
||||
|
||||
##### interval?
|
||||
|
||||
`number` = `3000`
|
||||
|
||||
Minimum interval between updates of the live message, in milliseconds.
|
||||
|
||||
##### onError?
|
||||
|
||||
(`error`) => `void`
|
||||
|
||||
Error handler for sending, updating and deleting messages. Errors are logged when it is omitted.
|
||||
|
||||
#### Returns
|
||||
|
||||
`LiveMessage`
|
||||
|
||||
## Methods
|
||||
|
||||
### end()
|
||||
|
||||
> **end**(`text?`): `Promise`\<`void`\>
|
||||
|
||||
Defined in: [src/api.ts:1049](../api.ts#L1049)
|
||||
|
||||
Finalize the live message with the text, or with the last text when omitted.
|
||||
A message without text is deleted. The next update starts a new live message.
|
||||
The returned promise resolves after all queued commands complete.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### text?
|
||||
|
||||
`string` = `...`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<`void`\>
|
||||
|
||||
***
|
||||
|
||||
### update()
|
||||
|
||||
> **update**(`text`): `void`
|
||||
|
||||
Defined in: [src/api.ts:1031](../api.ts#L1031)
|
||||
|
||||
Set the text of the live message.
|
||||
The first text is sent at once; later texts update the message at most once per interval.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### text
|
||||
|
||||
`string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
Reference in new issue
Block a user