@juzi/whatsapp-web.js
Advanced tools
Comparing version 1.18.5 to 1.18.6
@@ -264,1 +264,5 @@ const { Client, Location, List, Buttons, LocalAuth} = require('./index'); | ||
client.on('contact_name_change', (contact, newName, oldName) => { | ||
console.log('contact name change', contact, newName, oldName); | ||
}); | ||
@@ -277,2 +277,5 @@ | ||
on(event: 'remote_session_saved', listener: () => void): this | ||
/** Emitted when a contact name changes */ | ||
on(event: 'contact_name_change', listener: (contact: Contact, newName: string, oldName: string) => void): this | ||
} | ||
@@ -279,0 +282,0 @@ |
{ | ||
"name": "@juzi/whatsapp-web.js", | ||
"version": "1.18.5", | ||
"version": "1.18.6", | ||
"description": "Library for interacting with the WhatsApp Web API ", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -515,2 +515,7 @@ 'use strict'; | ||
await page.exposeFunction('onContactNameChange', async (contact, newName, oldName) => { | ||
const whatsappContact = await this.getContactById(contact.id); | ||
this.emit(Events.CONTACT_NAME_CHANGE, whatsappContact, newName, oldName); | ||
}); | ||
await page.evaluate(() => { | ||
@@ -535,3 +540,3 @@ window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); }); | ||
}); | ||
window.Store.Contact.on('change:name', (contact, newName, oldName) => {window.onContactNameChange(contact, newName, oldName);}); | ||
{ | ||
@@ -538,0 +543,0 @@ const module = window.Store.createOrUpdateReactionsModule; |
@@ -55,3 +55,4 @@ 'use strict'; | ||
INCOMING_CALL: 'incoming_call', | ||
REMOTE_SESSION_SAVED: 'remote_session_saved' | ||
REMOTE_SESSION_SAVED: 'remote_session_saved', | ||
CONTACT_NAME_CHANGE: 'contact_name_change', | ||
}; | ||
@@ -58,0 +59,0 @@ |
243356
5738