File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,9 @@ export interface AuthSettings {
242242 appVerificationDisabledForTesting: boolean ;
243243}
244244
245+ // @public
246+ export function beforeAuthStateChanged(auth : Auth , callback : (user : User | null ) => void | Promise <void >, onAbort ? : () => void ): Unsubscribe ;
247+
245248// @public
246249export const browserLocalPersistence: Persistence ;
247250
Original file line number Diff line number Diff line change @@ -83,6 +83,26 @@ export function onIdTokenChanged(
8383 completed
8484 ) ;
8585}
86+ /**
87+ * Adds a blocking callback that runs before an auth state change
88+ * sets a new user.
89+ *
90+ * @param auth - The {@link Auth} instance.
91+ * @param callback - callback triggered before new user value is set.
92+ * If this throws, it will block the user from being set.
93+ * @param onAbort - callback triggered if a later before state changed
94+ * callback throws, allowing you to undo any side effects.
95+ */
96+ export function beforeAuthStateChanged (
97+ auth : Auth ,
98+ callback : ( user : User | null ) => void | Promise < void > ,
99+ onAbort ?: ( ) => void ,
100+ ) : Unsubscribe {
101+ return getModularInstance ( auth ) . beforeAuthStateChanged (
102+ callback ,
103+ onAbort
104+ ) ;
105+ }
86106/**
87107 * Adds an observer for changes to the user's sign-in state.
88108 *
You can’t perform that action at this time.
0 commit comments