@bzr/bazaar
    Preparing search index...

    Class BazaarApp

    The primary class of the Bazaar JS SDK to help you more easily build web apps with Bazaar.

    Index

    Constructors

    Properties

    collections: CollectionsAPI

    Access to the collections API

    monetization: MonetizationAPI

    Access to the monetization API

    permissions: PermissionsAPI

    Access to the permissions API

    social: SocialAPI

    Access to the social API

    Methods

    • Gets a collection interface (API access to the specified collection)

      Type Parameters

      Parameters

      • collectionName: string

        The name of the collection to create the interface for.

      • OptionalcollectionOptions: CollectionOptions

        An optional object for specifying an onCreate hook. The onCreate hook sets up a collection when it is created (e.g., to set up permissions)

      Returns CollectionAPI<T>

    • Checks if the user is logged in. i.e. if an access token is in local storage.

      Returns boolean

    • Opens a pop-up window to perform OAuth login. Will fallback to redirect login if pop-up fails to open, if options.type is not popup (meaning an app has explicitly opted out of falling back to redirect login)

      Parameters

      Returns Promise<void>

    • Logs out a user. Deletes the access token from local storage and reloads the page.

      Returns void

    • Sets a callback function an app can run when it connects or re-connects to the API.

      Parameters

      Returns void

    • Sets a callback function an app can run when an API disconnection occurs.

      e.g. Invalid access token

      Parameters

      • f: (bzr: BazaarApp, message: string) => Promise<void>

      Returns void

    • Sets a callback function an app can run when a user has successfully logged in.

      e.g. Set state, redirect, etc.

      Parameters

      Returns void

    • Sets a callback function an app can run a login error occurs.

      e.g. Authorization code is invalid

      Parameters

      • f: (bzr: BazaarApp, message: string) => Promise<void>

      Returns void