Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ContextValue

Hierarchy

  • ContextValue

Index

Methods

Frame

  • Frame(): Record<string, any>[]
  • Frame(index: number): Record<string, any>
  • This function is how you access your current frame. This function does not get new data or push changes to Easybase. If you want to syncronize your frame and Easybase, call sync() then Frame().

    abstract

    Returns Record<string, any>[]

    Array of records corresponding to the current frame. Call sync() to push changes that you have made to this array.

  • This function is how you access a single object your current frame. This function does not get new data or push changes to Easybase. If you want to syncronize your frame and Easybase, call sync() then Frame().

    abstract

    Parameters

    • index: number

    Returns Record<string, any>

    Single record corresponding to that object within the current frame. Call sync() to push changes that you have made to this object.

Query

  • Query(options: QueryOptions): Promise<Record<string, any>[]>
  • async

    View a query by name. This returns an isolated array that has no effect on your frame or frame configuration. sync() and Frame() have no relationship with a Query(). An edited Query cannot be synced with your database, use Frame() for realtime database array features.

    Parameters

    Returns Promise<Record<string, any>[]>

    Isolated array of records in the same form as Frame(). Editing this array has no effect and cannot be synced with your database. Use Frame() for realtime database features.

addRecord

  • Manually add a record to your collection regardless of your current frame. You must call sync() after this to see updated response.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

configureFrame

  • Configure the current frame size. Set the offset and amount of records to retreive assume you don't want to receive your entire collection. This is useful for paging.

    abstract

    Parameters

    Returns StatusResponse

    StatusResponse

currentConfiguration

deleteRecord

  • Manually delete a record from your collection regardless of your current frame. You must call sync() after this to see updated response.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

fullTableSize

  • fullTableSize(): Promise<number>
  • fullTableSize(tableName: string): Promise<number>
  • Gets the number of records in your table.

    async

    Returns Promise<number>

    The the number of records in your table.

  • Gets the number of records in your table.

    async

    Parameters

    • tableName: string

    Returns Promise<number>

    The the number of records in your table.

getUserAttributes

  • getUserAttributes(): Promise<Record<string, string>>
  • Retrieve the currently signed in users attribute object.

    async

    Returns Promise<Record<string, string>>

    Promise<Record<string, string>>

isUserSignedIn

  • isUserSignedIn(): boolean
  • Check if a user is currently signed in.

    Returns boolean

onSignIn

  • onSignIn(callback: () => void): void
  • Pass a callback function to run when a user signs in. This callback function will run after either successfully signing in with the signIn() function OR after a user is automatically signed in via valid tokens saved to the browser from a previous instance. This is best placed with useEffect(() => {}, []);

    Parameters

    • callback: () => void

      callback function to run on sign in event

        • (): void
        • Returns void

    Returns void

setUserAttribute

  • setUserAttribute(key: string, value: string): Promise<StatusResponse>
  • Set a single attribute of the currently signed in user. Can also be updated visually in the Easybase 'Users' tab.

    async
    abstract

    Parameters

    • key: string

      Object key. Can be a new key or existing key.

    • value: string

      attribute value.

    Returns Promise<StatusResponse>

    Promise

signIn

  • Sign in a user that already exists for a project. This will save authentication tokens to a user's browser so that they will be automatically authenticated when they return to the application. These authentcation tokens will become invalid when a user signs out or after 24 hours.

    abstract
    async

    Parameters

    • userID: string

      unique identifier for new user. Usually an email or phone number.

    • password: string

      user password.

    Returns Promise<StatusResponse>

    Promise

signOut

  • signOut(): void
  • Sign out the current user and invalidate their cached tokens.

    Returns void

signUp

  • signUp(newUserID: string, password: string, userAttributes?: Record<string, string>): Promise<StatusResponse>
  • Create a new user for your project. You must still call signIn() after signing up.

    abstract
    async

    Parameters

    • newUserID: string

      unique identifier for new user. Usually an email or phone number.

    • password: string

      user password. Must be at least 8 characters long.

    • Optional userAttributes: Record<string, string>

      Optional object to store user attributes. Can also be edited visually in the Easybase 'Users' tab.

    Returns Promise<StatusResponse>

    Promise

sync

  • Call this method to syncronize your current changes with your database. Delections, additions, and changes will all be reflected by your backend after calling this method. Call Frame() after this to get a normalized array of the freshest data.

    abstract
    async

    Returns Promise<StatusResponse>

    Promise

tableTypes

  • tableTypes(): Promise<Record<string, any>>
  • tableTypes(tableName: string): Promise<Record<string, any>>
  • Retrieve an object detailing the columns in your table mapped to their corresponding type.

    async

    Returns Promise<Record<string, any>>

    Object detailing the columns in your table mapped to their corresponding type.

  • Retrieve an object detailing the columns in your table mapped to their corresponding type.

    async

    Parameters

    • tableName: string

    Returns Promise<Record<string, any>>

    Object detailing the columns in your table mapped to their corresponding type.

updateRecordFile

  • Upload a file to your backend and attach it to a specific record. columnName must reference a column of type 'file'. Call sync() for fresh data with proper attachment links to cloud hosting.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

updateRecordImage

  • Upload an image to your backend and attach it to a specific record. columnName must reference a column of type 'image'. The file must have an extension of an image. Call sync() for fresh data with proper attachment links to cloud hosting.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

updateRecordVideo

  • Upload a video to your backend and attach it to a specific record. columnName must reference a column of type 'video'. The file must have an extension of a video. Call sync() for fresh data with proper attachment links to cloud hosting.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

useFrameEffect

  • useFrameEffect(effect: React.EffectCallback): void
  • This hook runs when the Frame changes. This can be triggered by calling sync().

    abstract

    Parameters

    • effect: React.EffectCallback

      Callback function that executes when Frame changes.

    Returns void

Generated using TypeDoc