Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AccountManagerEvent

AccountManagerEvent is a simple data class used to pass information from the AccountManager to registered event-listeners when an account management event occurs. The AccountManagerEvent class also defines constants representing the available account management events.

To register for an account management event, use AccountManager.addEventListener method.

Hierarchy

  • Event
    • AccountManagerEvent

Index

Constructors

constructor

  • Parameters

    • type: string
    • Default value userID: string | null = null
    • Default value account: UserAccount | null = null
    • Default value status: string | null = null

    Returns AccountManagerEvent

Properties

Optional target

target: EventDispatcher

type

type: string

Static Readonly ACCOUNT_ADDED

ACCOUNT_ADDED: "ACCOUNT_ADDED" = "ACCOUNT_ADDED"

Dispatched when the AccountManager is informed by Union Server that a user account was created. This event is available when the AccountManager is watching for user accounts only (see AccountManager.watchForAccounts).

Static Readonly ACCOUNT_REMOVED

ACCOUNT_REMOVED: "ACCOUNT_REMOVED" = "ACCOUNT_REMOVED"

Dispatched when the AccountManager is informed by Union Server that a user account was deleted. This event is available when the AccountManager is watching for user accounts only (see AccountManager.watchForAccounts).

Static Readonly CREATE_ACCOUNT_RESULT

CREATE_ACCOUNT_RESULT: "CREATE_ACCOUNT_RESULT" = "CREATE_ACCOUNT_RESULT"

Dispatched when the result of an earlier call to AccountManager.createAccount method is received. To determine the result of the account-creation request, use getStatus(), which has the following possible return values:

  • Status.SUCCESS
  • Status.ERROR
  • Status.ACCOUNT_EXISTS

Static Readonly REMOVE_ACCOUNT_RESULT

REMOVE_ACCOUNT_RESULT: "REMOVE_ACCOUNT_RESULT" = "REMOVE_ACCOUNT_RESULT"

Dispatched when the result of an earlier call to AccountManager.removeAccount method is received. To determine the result of the account-removal request, use getStatus(), which has the following possible return values:

  • Status.SUCCESS
  • Status.ERROR
  • Status.ACCOUNT_NOT_FOUND
  • Status.AUTHORIZATION_FAILED

Static Readonly STOP_WATCHING_FOR_ACCOUNTS_RESULT

STOP_WATCHING_FOR_ACCOUNTS_RESULT: "STOP_WATCHING_FOR_ACCOUNTS_RESULT" = "STOP_WATCHING_FOR_ACCOUNTS_RESULT"

Dispatched when the AccountManager receives the result of an earlier stopWatchingForAccounts() request. To determine the result of the attempt, use getStatus(), which has the following possible return values:

  • Status.SUCCESS
  • Status.ERROR
  • Status.NOT_WATCHING

Static Readonly SYNCHRONIZE

SYNCHRONIZE: "SYNCHRONIZE" = "SYNCHRONIZE"

Dispatched when the AccountManager's list of user accounts has finished synchronization after a watchForAccounts() request.

Static Readonly WATCH_FOR_ACCOUNTS_RESULT

WATCH_FOR_ACCOUNTS_RESULT: "WATCH_FOR_ACCOUNTS_RESULT" = "WATCH_FOR_ACCOUNTS_RESULT"

Dispatched when the AccountManager receives the result of an earlier watchForAccounts() request. To determine the result of the request, use getStatus(), which has the following possible return values:

  • Status.SUCCESS
  • Status.ERROR
  • Status.ALREADY_WATCHING

Methods

getAccount

  • Returns the UserAccount object pertaining to this account manager event. For example, for an AccountManagerEvent.ACCOUNT_REMOVED event, getAccount() returns the UserAccount object for the removed account.

    Returns UserAccount | null

getStatus

  • getStatus(): string | null
  • Returns the status of the operation to which this event pertains. The getStatus() method's return value is always one of the Status class's constants. For example, if the AccountManagerEvent.CREATE_ACCOUNT_RESULT event occurs in response to a successful account-creation attempt, getStatus() will return the value of Status.SUCCESS.

    To respond to a status, compare the return of getStatus() to one of the Status constants.

        if (e.getStatus() == Status.SUCCESS) {
            showAccountCreatedScreen();
        }

    For a list of specific status values that can be returned during a particular event, see the documentation for that event.

    Returns string | null

getUserID

  • getUserID(): string | null
  • Returns the user ID of the account to which this event pertains. For example, for the AccountManagerEvent.ACCOUNT_ADDED event, getUserID() returns the userID of the account that was added to the server.

    Returns string | null