From 110d7f7b485bd53622cb09dae11dce33ccbe38ed Mon Sep 17 00:00:00 2001 From: Luca Peruzzo <69015314+luca-peruzzo@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:53:11 +0100 Subject: [PATCH] make initialize return a Promise (#328) closes #152 --- src/definitions.ts | 2 +- src/web.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/definitions.ts b/src/definitions.ts index 517ed11..013c970 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -143,7 +143,7 @@ export interface GoogleAuthPlugin { * @param options - Optional initialization options. * @since 3.1.0 */ - initialize(options?: InitOptions): void; + initialize(options?: InitOptions): Promise; /** * Initiates the sign-in process and returns a Promise that resolves with the user information. diff --git a/src/web.ts b/src/web.ts index 58bde00..d5c8d26 100644 --- a/src/web.ts +++ b/src/web.ts @@ -39,7 +39,7 @@ export class GoogleAuthWeb extends WebPlugin implements GoogleAuthPlugin { scopes: [], grantOfflineAccess: false, } - ) { + ): Promise { if (typeof window === 'undefined') { return; } @@ -64,6 +64,7 @@ export class GoogleAuthWeb extends WebPlugin implements GoogleAuthPlugin { }); this.addUserChangeListener(); + return this.gapiLoaded; } platformJsLoaded() {