Skip to content

Commit

Permalink
fix: Fixed emitting events
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Jun 17, 2024
1 parent aa5b07d commit 95e934d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/controllers/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,17 @@ export async function injectApi(
path.join(__dirname, '../../dist/lib/wapi', 'wapi.js')
),
});
onLoadingScreen(page, onLoadingScreenCallBack);
await onLoadingScreen(page, onLoadingScreenCallBack);
// Make sure WAPI is initialized
await page
.waitForFunction(() => {
return (
typeof window.WAPI !== 'undefined' &&
typeof window.Store !== 'undefined' &&
window.WPP.isReady
);
})
.catch(() => false);
}

/**
Expand Down

0 comments on commit 95e934d

Please sign in to comment.