Add the 'unread_count' event. Listen to changes on Chat.unreadCount (#2059)
* Initial commit * Update index.d.ts * The functions was returning a 'brief' chat data. With this, it will return full Chat model.. * Eslint suggested fixex --------- Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com> Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
parent
dc16bbbdac
commit
c44af204a1
1 changed files with 18 additions and 1 deletions
|
|
@ -407,6 +407,15 @@ class Client extends EventEmitter {
|
|||
|
||||
});
|
||||
|
||||
await page.exposeFunction('onChatUnreadCountEvent', async (data) =>{
|
||||
const chat = await this.getChatById(data.id);
|
||||
|
||||
/**
|
||||
* Emitted when the chat unread count changes
|
||||
*/
|
||||
this.emit(Events.UNREAD_COUNT, chat);
|
||||
});
|
||||
|
||||
await page.exposeFunction('onMessageMediaUploadedEvent', (msg) => {
|
||||
|
||||
const message = new Message(this, msg);
|
||||
|
|
@ -526,7 +535,8 @@ class Client extends EventEmitter {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.Store.Chat.on('change:unreadCount', (chat) => {window.onChatUnreadCountEvent(chat);});
|
||||
|
||||
{
|
||||
const module = window.Store.createOrUpdateReactionsModule;
|
||||
const ogMethod = module.createOrUpdateReactions;
|
||||
|
|
|
|||
Loading…
Reference in a new issue