Hierarchy

Implements

Constructors

Properties

#app: FirebaseApp

The Firebase app instance

Member

#appName: string

The Firebase app name. If none is provided, the default is "[DEFAULT]"

Member

#auth: Auth

The Firebase auth instance

Member

See

https://firebase.google.com/docs/reference/js/auth

#firestore: Firestore
#options: FirebaseOptions

The Firebase options object

Member

See

https://firebase.google.com/docs/reference

#storage: FirebaseStorage

Methods

  • Parameters

    • app: FirebaseApp

      A Firebase app instance

    Returns void

  • Parameters

    • auth: Auth

      A Firebase auth instance

    Returns void

  • Initialize the document to obtain the data.

    Parameters

    • collectionName: string

      The name of the collection to initialize the document

    • documentName: string

      The name of the document to be initialized

    Returns Promise<InitializedDocument>

    • The document and reference objects
  • Parameters

    • firestore: Firestore

      A Firebase firestore instance

    Returns void

  • Parameters

    • storage: FirebaseStorage

    Returns void

  • Sign the user in anonymously.

    Returns Promise<UserCredential>

    The anonymous user's credentials

  • Creates a document with a data object.

    Parameters

    • collectionName: string

      The name of the collection to create the doc in

    • documentName: string

      The name of the document to create

    • documentData: object

      The data to create the document with

    Returns Promise<DocumentReference<DocumentData>>

    A reference to the document on success

  • Generate a random string of characters to be used as a unique id

    Returns string | number[]

    • The result of the call to the uuid function
  • Convert an angle in degrees to radians

    Parameters

    • d: number

      the angle in degrees

    Returns number

    the angle in radians

  • Delete the user's account and notifies on success or failure.

    Parameters

    • userUpdate: UserUpdate

      The user update object with new details

    • deleteDocuments: (() => Promise<void>)

      A function that deletes user-associated data

        • (): Promise<void>
        • Returns Promise<void>

    Returns Promise<string>

    An empty string on success, else an error message

  • Deletes a field from a given document.

    Parameters

    • collectionName: string

      The name of the collection to delete from

    • documentName: string

      The name of the document to delete from

    • field: string

      The field to delete

    Returns Promise<boolean>

    True on success, else false

  • Deletes an entire document from the firestore.

    Parameters

    • collectionName: string

      The name of the collection to delete from

    • documentName: string

      The name of the document to delete

    Returns Promise<boolean>

    True on success, else false

  • Delete an image from the storage bucket.

    Parameters

    • imagePath: string

      The path of the image to be deleted

    Returns Promise<boolean>

    true if delete was successful, else false

  • Calculate the linear distance between two points using the Haversine formula

    Todo

    Limit the coordinates to the min/max ranges

    See

    Point

    Parameters

    Returns number

    The distance in km

  • Retreive all documents for a collection. Requires read permission for all documents.

    Parameters

    • collectionName: string

      The name of the collection to get docs from

    Returns Promise<QueryDocumentSnapshot<DocumentData>[]>

    • An array of documents
  • Returns FirebaseStorage

    The initialized Firestore storage

  • Reset the user password.

    Parameters

    • email: string

      The user's email address

    Returns Promise<boolean>

    True on success, else false

  • Read a document from the given collection.

    Parameters

    • collectionName: string

      The name of the collection containing the document

    • documentName: string

      The name of the document being updated

    Returns Promise<DocumentData>

    The data from the retrieved document

  • Search a given collection field for a value.

    Parameters

    • collectionName: string

      The name of the collection to search

    • field: string

      The name of the field to search

    • needle: string

      The value to search for

    • comparison: WhereFilterOp

      A string describing the comparison operator

    • caseSensitive: boolean = false

      True for a case-sensitive search (default false)

    Returns Promise<false | SearchResult[]>

    An array of search results or false on failure

  • Sign in to Firebase using email and password.

    Parameters

    • email: string

      The user's email address

    • password: string

      The user's password

    Returns Promise<string>

    A sign in error message or an empty string on success

  • Sign up a new user. Create a new user document and update the user profile in firestore. Requires write permission for the User collection.

    Parameters

    • userUpdate: UserUpdate

      The user update object set with new data

    Returns Promise<string>

    A sign up error message or an empty string on success

  • Updates a document in the given collection. Creates the document if it does not exist.

    Parameters

    • collectionName: string

      The name of the collection to update

    • documentName: string

      The name of the document to update

    • updateData: object

      The updated document data

    Returns Promise<boolean>

    True on success, else false

  • Updates the user's account details and notifies the caller on success or error. Requires write permission for the User collection in firestore.

    Parameters

    • userUpdate: UserUpdate

      The updated user information

    Returns Promise<string>

    An empty string on success, else an error message

  • Upload an image to the firebase storage bucket.

    Parameters

    • imageFileURL: string

      the url of the local image to be uploaded

    • onUploadComplete: ((__namedParameters) => void)

      callback to set the download url

        • (__namedParameters): void
        • Parameters

          • __namedParameters: Object

          Returns void

    • setProgress: ((progress) => void) = ...

      callback to update the progress bar

        • (progress): void
        • Parameters

          • progress: number

          Returns void

    • handleError: ((error) => void) = console.error

      callback to handle errors

        • (error): void
        • Parameters

          • error: any

          Returns void

    • detailedProgress: boolean = false

      use uploadBytesResumable to track detailed progress

    • unsubscribe: Unsubscribe = ...

      unsubscribe from the upload task (detailed progress only)

    Returns Promise<void>

Generated using TypeDoc