Class App<FunctionsFactoryType, CustomDataType>

The class represents an Atlas App Services Application.

const app = new App({ id: "my-app-qwert" });

Type Parameters

Constructors

Accessors

  • get baseUrl(): string
  • Experimental

    Get the current base URL used for sending requests to Atlas App Services.

    If an updateBaseUrl operation is currently in progress, this value will not be updated with the new value until that operation has completed. This feature is experimental and may be changed or removed.

    Returns string

  • get emailPasswordAuth(): EmailPasswordAuth
  • Perform operations related to the email/password auth provider.

    Returns EmailPasswordAuth

    An instance of the email password authentication provider.

  • get id(): string
  • Returns string

    The app ID.

Methods

  • Adds a listener that will be fired on various user events. This includes login, logout, switching users, linking users and refreshing custom data.

    Parameters

    • callback: AppChangeCallback

      A callback function that will be called when the event occurs.

    Returns void

  • Delete the user. NOTE: This irrecoverably deletes the user from the device as well as the server!

    Parameters

    Returns Promise<void>

    A promise that resolves once the user has been deleted.

  • Removes all event listeners previously added via App.addListener.

    Returns void

  • Removes an event listener previously added via App.addListener.

    Parameters

    Returns void

  • Logs out and removes a user from the client.

    Parameters

    Returns Promise<void>

    A promise that resolves once the user has been logged out and removed from the app.

  • Switches the current user to the one specified in user.

    Parameters

    • user: AnyUser

      The user to switch to.

    Returns void

    Throws

    an Error if the new user is logged out or removed.

  • Experimental

    Update the base URL used for sending requests to Atlas App Services. If this is set to an empty string or null, it will reset the base URL to the default one.

    If this operation fails, the app will continue to use the original base URL. If another App operation is started while this function is in progress, that request will use the original base URL location information. This feature is experimental and may be changed or removed.

    Parameters

    • newUrl: null | string

    Returns Promise<void>

  • Get or create a singleton Realm App from an ID. Calling this function multiple times with the same ID will return the same instance.

    Parameters

    • id: string

      The Realm App ID visible from the Atlas App Services UI or a configuration.

    Returns App<DefaultFunctionsFactory, DefaultObject>

    The Realm App instance.

  • Get or create a singleton Realm App from an ID. Calling this function multiple times with the same ID will return the same instance.

    Parameters

    • id: string

      The Realm App ID visible from the Atlas App Services UI or a configuration.

    Returns App<DefaultFunctionsFactory, DefaultObject>

    The Realm App instance.

    Deprecated

    Use App.get.

Generated using TypeDoc