mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-19 20:19:14 +00:00
fix: added timeout to accepted states
This makes the client more reliable since it doesn't quit as soon as it looses conection from the phone for a second. Messages should be queued by WhatsApp Web.
This commit is contained in:
@@ -200,8 +200,8 @@ class Client extends EventEmitter {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.exposeFunction('onAppStateChangedEvent', (AppState, state) => {
|
await page.exposeFunction('onAppStateChangedEvent', (_AppState, state) => {
|
||||||
const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING];
|
const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT];
|
||||||
if (!ACCEPTED_STATES.includes(state)) {
|
if (!ACCEPTED_STATES.includes(state)) {
|
||||||
/**
|
/**
|
||||||
* Emitted when the client has been disconnected
|
* Emitted when the client has been disconnected
|
||||||
|
|||||||
Reference in New Issue
Block a user