From b7f16a3cb53b7646aac93f2f518f6f9fefd3d258 Mon Sep 17 00:00:00 2001 From: Luca Peruzzo Date: Wed, 29 Nov 2023 09:29:38 +0100 Subject: [PATCH] make initialize return a Promise 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() {