mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 12:39:20 +00:00
update typings for fetchMessages changes
This commit is contained in:
3
index.d.ts
vendored
3
index.d.ts
vendored
@@ -930,10 +930,9 @@ declare namespace WAWebJS {
|
|||||||
|
|
||||||
export interface MessageSearchOptions {
|
export interface MessageSearchOptions {
|
||||||
/**
|
/**
|
||||||
* The amount of messages to return.
|
* The amount of messages to return. If no limit is specified, the available messages will be returned.
|
||||||
* Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation.
|
* Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation.
|
||||||
* Set this to Infinity to load all messages.
|
* Set this to Infinity to load all messages.
|
||||||
* @default 50
|
|
||||||
*/
|
*/
|
||||||
limit?: number
|
limit?: number
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class Chat extends Base {
|
|||||||
const chat = window.Store.Chat.get(chatId);
|
const chat = window.Store.Chat.get(chatId);
|
||||||
let msgs = chat.msgs.models.filter(msgFilter);
|
let msgs = chat.msgs.models.filter(msgFilter);
|
||||||
|
|
||||||
if (searchOptions && searchOptions.limit) {
|
if (searchOptions && searchOptions.limit > 0) {
|
||||||
while (msgs.length < searchOptions.limit) {
|
while (msgs.length < searchOptions.limit) {
|
||||||
const loadedMessages = await chat.loadEarlierMsgs();
|
const loadedMessages = await chat.loadEarlierMsgs();
|
||||||
if (!loadedMessages) break;
|
if (!loadedMessages) break;
|
||||||
|
|||||||
Reference in New Issue
Block a user