MCPcopy
hub / github.com/ampproject/amphtml / configureGoogleSignIn

Function configureGoogleSignIn

third_party/subscriptions-project/swg-gaa.js:2549–2569  ·  view source on GitHub ↗

* Loads the Google Sign-In API. * * This function is used in two places. * 1. The publisher's Google Sign-In iframe. * 2. (Optional) Demos that allow users to sign out. * * @return {!Promise}

()

Source from the content-addressed store, hash-verified

2547 * @return {!Promise}
2548 */
2549function configureGoogleSignIn() {
2550 // Wait for Google Sign-In API.
2551 return (
2552 new Promise((resolve) => {
2553 const apiCheckInterval = setInterval(() => {
2554 if (!!self.gapi) {
2555 clearInterval(apiCheckInterval);
2556 resolve();
2557 }
2558 }, 50);
2559 })
2560 // Load Auth2 module.
2561 .then(() => new Promise((resolve) => self.gapi.load('auth2', resolve)))
2562 // Specify "redirect" mode. It plays nicer with webviews.
2563 .then(
2564 () =>
2565 // Only initialize Google Sign-In once.
2566 self.gapi.auth2.getAuthInstance() || self.gapi.auth2.init()
2567 )
2568 );
2569}
2570
2571/**
2572 * Calls Swgjs.

Callers 2

signOutMethod · 0.85
showMethod · 0.85

Calls 6

setIntervalFunction · 0.50
clearIntervalFunction · 0.50
resolveFunction · 0.50
thenMethod · 0.45
loadMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected