You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Starting point for interacting with the WhatsApp Web API
24
21
* @extends {EventEmitter}
25
22
* @param {object} options - Client options
26
-
* @param {AuthStrategy} options.authStrategy - Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used.
23
+
* @param {AuthStrategy} options.authStrategy - Determines how to save and restore sessions. Otherwise, NoAuth will be used.
27
24
* @param {string} options.webVersion - The version of WhatsApp Web to use. Use options.webVersionCache to configure how the version is retrieved.
28
25
* @param {object} options.webVersionCache - Determines how to retrieve the WhatsApp Web version. Defaults to a local cache (LocalWebCache) that falls back to latest if the requested version is not found.
29
26
* @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer
30
27
* @param {function} options.evalOnNewDoc - function to eval on new doc
* @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up
33
-
* @param {string} options.restartOnAuthFail - @deprecated This option should be set directly on the LegacySessionAuth.
34
-
* @param {object} options.session - @deprecated Only here for backwards-compatibility. You should move to using LocalAuth, or set the authStrategy to LegacySessionAuth explicitly.
35
30
* @param {number} options.takeoverOnConflict - If another whatsapp web session is detected (another browser), take over the session in the current browser
36
31
* @param {number} options.takeoverTimeoutMs - How much time to wait before taking over the session
37
32
* @param {string} options.userAgent - User agent to use in puppeteer
@@ -113,13 +108,8 @@ class Client extends EventEmitter {
// make sure all modules are ready before injection
238
-
// 2 second delay after authentication makes sense and does not need to be made dyanmic or removed
239
-
awaitnewPromise(r=>setTimeout(r,2000));
240
-
awaitthis.pupPage.evaluate(ExposeLegacyStore);
241
-
}
224
+
awaitthis.pupPage.evaluate(ExposeStore);
225
+
242
226
letstart=Date.now();
243
227
letres=false;
244
228
while(start>(Date.now()-30000)){
@@ -354,17 +338,14 @@ class Client extends EventEmitter {
354
338
}
355
339
356
340
// ocVersion (isOfficialClient patch)
357
-
// remove after 2.3000.x hard release
358
341
awaitpage.evaluateOnNewDocument(()=>{
359
-
constoriginalError=Error;
360
-
window.originalError=originalError;
342
+
window.originalError=Error;
361
343
//eslint-disable-next-line no-global-assign
362
-
Error=function(message){
363
-
consterror=neworiginalError(message);
364
-
constoriginalStack=error.stack;
365
-
if(error.stack.includes('moduleRaid'))error.stack=originalStack+'\n at https://web.whatsapp.com/vendors~lazy_loaded_low_priority_components.05e98054dbd60f980427.js:2:44';
344
+
Error=((message)=>{
345
+
consterror=newwindow.originalError(message);
346
+
error.stack=error.stack+'\n at https://web.whatsapp.com/vendors~lazy_loaded_low_priority_components.05e98054dbd60f980427.js:2:44';
366
347
returnerror;
367
-
};
348
+
}).bind(Error);
368
349
});
369
350
370
351
awaitpage.goto(WhatsWebURL,{
@@ -778,70 +759,54 @@ class Client extends EventEmitter {
0 commit comments