@@ -6900,22 +6900,38 @@ declare namespace chrome {
6900
6900
* @since Chrome 78
6901
6901
*/
6902
6902
export namespace loginState {
6903
- export interface SessionStateChangedEvent extends chrome.events.Event<(sessionState: SessionState) => void> {}
6904
-
6905
- /** Possible profile types. */
6906
- export type ProfileType = "SIGNIN_PROFILE" | "USER_PROFILE";
6903
+ export enum ProfileType {
6904
+ SIGNIN_PROFILE = "SIGNIN_PROFILE",
6905
+ USER_PROFILE = "USER_PROFILE",
6906
+ }
6907
6907
6908
- /** Possible session states. */
6909
- export type SessionState = "UNKNOWN" | "IN_OOBE_SCREEN" | "IN_LOGIN_SCREEN" | "IN_SESSION" | "IN_LOCK_SCREEN";
6908
+ export enum SessionState {
6909
+ UNKNOWN = "UNKNOWN",
6910
+ IN_OOBE_SCREEN = "IN_OOBE_SCREEN",
6911
+ IN_LOGIN_SCREEN = "IN_LOGIN_SCREEN",
6912
+ IN_SESSION = "IN_SESSION",
6913
+ IN_LOCK_SCREEN = "IN_LOCK_SCREEN",
6914
+ IN_RMA_SCREEN = "IN_RMA_SCREEN",
6915
+ }
6910
6916
6911
- /** Gets the type of the profile the extension is in. */
6912
- export function getProfileType(callback: (profileType: ProfileType) => void): void;
6917
+ /**
6918
+ * Gets the type of the profile the extension is in.
6919
+ *
6920
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6921
+ */
6922
+ export function getProfileType(): Promise<`${ProfileType}`>;
6923
+ export function getProfileType(callback: (result: `${ProfileType}`) => void): void;
6913
6924
6914
- /** Gets the current session state. */
6915
- export function getSessionState(callback: (sessionState: SessionState) => void): void;
6925
+ /**
6926
+ * Gets the current session state.
6927
+ *
6928
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6929
+ */
6930
+ export function getSessionState(): Promise<`${SessionState}`>;
6931
+ export function getSessionState(callback: (sessionState: `${SessionState}`) => void): void;
6916
6932
6917
- /** Dispatched when the session state changes. sessionState is the new session state.*/
6918
- export const onSessionStateChanged: SessionStateChangedEvent ;
6933
+ /** Dispatched when the session state changes. ` sessionState` is the new session state.*/
6934
+ export const onSessionStateChanged: events.Event<(sessionState: `${SessionState}`) => void> ;
6919
6935
}
6920
6936
6921
6937
////////////////////
0 commit comments