Add loader for google services
This commit is contained in:
@@ -15,6 +15,7 @@ let gsiInited = false;
|
||||
export function initGoogleClients(callback: () => void) {
|
||||
// If everything is already initialized, just run the callback.
|
||||
if (gapiInited && gsiInited) {
|
||||
isGoogleApiReady.set(true); // Ensure it's set if called again
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
@@ -37,7 +38,6 @@ export function initGoogleClients(callback: () => void) {
|
||||
})
|
||||
.then(() => {
|
||||
gapiInited = true;
|
||||
isGoogleApiReady.set(true);
|
||||
// Now that GAPI is ready, initialize the GSI client.
|
||||
initGsiClient(callback);
|
||||
});
|
||||
@@ -104,6 +104,7 @@ function initGsiClient(callback: () => void) {
|
||||
}
|
||||
}
|
||||
});
|
||||
isGoogleApiReady.set(true);
|
||||
callback();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user