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:
parent
3c774d6553
commit
a293146ed8
1 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue