Commit 656ab2bf authored by isstuev's avatar isstuev

fix

parent a39f4071
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));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment