mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
fix
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
function wait() {
|
||||
return new Promise(resolve => setTimeout(resolve, 500));
|
||||
}
|
||||
import appConfig from 'configs/app/config';
|
||||
import delay from 'lib/delay';
|
||||
|
||||
export default function isGoogleAnalyticsLoaded(retries = 3): Promise<boolean> {
|
||||
if (!retries) {
|
||||
if (!retries || !appConfig.googleAnalytics.propertyId) {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
return typeof window.ga?.getAll === 'function' ? Promise.resolve(true) : wait().then(() => isGoogleAnalyticsLoaded(retries - 1));
|
||||
return typeof window.ga?.getAll === 'function' ? Promise.resolve(true) : delay(500).then(() => isGoogleAnalyticsLoaded(retries - 1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user