Skip to content

Commit

Permalink
fix: page on load order
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Escher committed Sep 23, 2022
1 parent 76e61cc commit 1228a06
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/api/layers/host.layer.ts
Expand Up @@ -125,13 +125,6 @@ export class HostLayer {

let clear = !hasUserDataDir || (hasUserDataDir && !isValidToken);

await initWhatsapp(
this.page,
sessionToken,
clear,
this.options.whatsappVersion
);

this.page.on('load', () => {
this.log('verbose', 'Page loaded', { type: 'page' });
this.afterPageLoad();
Expand All @@ -140,6 +133,13 @@ export class HostLayer {
this.cancelAutoClose();
this.log('verbose', 'Page Closed', { type: 'page' });
});

await initWhatsapp(
this.page,
sessionToken,
clear,
this.options.whatsappVersion
);
}

protected async afterPageLoad() {
Expand Down

0 comments on commit 1228a06

Please sign in to comment.