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:
Pedro Lopez
2020-02-10 21:44:56 -04:00
parent 3c774d6553
commit a293146ed8

View File

@@ -200,8 +200,8 @@ class Client extends EventEmitter {
});
await page.exposeFunction('onAppStateChangedEvent', (AppState, state) => {
const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING];
await page.exposeFunction('onAppStateChangedEvent', (_AppState, state) => {
const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT];
if (!ACCEPTED_STATES.includes(state)) {
/**
* Emitted when the client has been disconnected