Constructors

Properties

locateSubscription: undefined | EmitterSubscription

Methods

  • Returns a string that is used to uniquely identify the device

    Returns Promise<string>

    Device ID

  • Returns Promise<string>

  • Reflects availability of the device for the Nearby search

    Returns Promise<boolean>

    true when is available or false when unavailable

  • Reflects the tracking intent for the device

    Returns Promise<boolean>

    Whether the user's movement data is getting tracked or not.

  • Gets the metadata that is set for the device

    Returns Promise<Object>

    Metadata JSON

  • Gets the name that is set for the device

    Returns Promise<string>

    Device name

  • Gets the active orders for the worker. The orders are sorted with the ordering in which the worker should complete them.

    Returns Promise<Map<string, Order>>

    Map of orders

  • A primary identifier that uniquely identifies the worker outside of HyperTrack. Example: email, phone number, database id It is usually obtained and set when the worker logs into the app. Set it to an empty string "" when the worker logs out of the app to un-bind the device from the worker and avoid unintentional tracking.

    Returns Promise<string>

  • Requests one-time location update and returns the location once it is available, or error.

    Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription will be automaticaly removed.

    This method will start location tracking if called, and will stop it when the location is received or the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to true), the tracking will not be stopped.

    Parameters

    Returns EmitterSubscription

    EmitterSubscription

    Example

    const subscription = HyperTrack.locate(location => {
    ...
    })

    // to unsubscribe
    subscription.remove()
  • Parameters

    • dynamicPublishableKey: string

    Returns void

  • Sets the availability of the device for the Nearby search

    Parameters

    • isAvailable: boolean

      true when is available or false when unavailable

    Returns void

  • Sets the tracking intent for the device

    Parameters

    • isTracking: boolean

    Returns void

  • Sets the metadata for the device

    Parameters

    • data: Object

      Metadata JSON

    Returns void

  • Sets the name for the device

    Parameters

    • name: string

    Returns void

  • A primary identifier that uniquely identifies the worker outside of HyperTrack. Example: email, phone number, database id It is usually obtained and set when the worker logs into the app. Set it to an empty string "" when the worker logs out of the app to un-bind the device from the worker and avoid unintentional tracking.

    Parameters

    • workerHandle: string

    Returns void

  • Subscribe to tracking errors

    Parameters

    • listener: ((errors) => void)

    Returns EmitterSubscription

    EmitterSubscription

    Example

    const subscription = HyperTrack.subscribeToErrors(errors => {
    errors.forEach(error => {
    // ... error
    })
    })

    // later, to stop listening
    subscription.remove()
  • Subscribe to availability changes

    Parameters

    • listener: ((isAvailable) => void)
        • (isAvailable): void
        • Parameters

          • isAvailable: boolean

          Returns void

    Returns EmitterSubscription

    EmitterSubscription

    Example

    const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => {
    if (isAvailable) {
    // ... ready to go
    }
    })

    // later, to stop listening
    subscription.remove()
  • Subscribe to tracking intent changes

    Parameters

    • listener: ((isTracking) => void)
        • (isTracking): void
        • Parameters

          • isTracking: boolean

          Returns void

    Returns EmitterSubscription

    EmitterSubscription

    Example

    const subscription = HyperTrack.subscribeToIsTracking(isTracking => {
    if (isTracking) {
    // ... ready to go
    }
    })

    // later, to stop listening
    subscription.remove()
  • Subscribe to location changes

    Parameters

    Returns EmitterSubscription

    EmitterSubscription

    Example

    const subscription = HyperTrack.subscribeToLocation(location => {
    ...
    })

    // later, to stop listening
    subscription.remove()
  • Subscribe to changes in the orders assigned to the worker

    Parameters

    • listener: ((orders) => void)
        • (orders): void
        • Parameters

          • orders: Map<string, Order>

          Returns void

    Returns EmitterSubscription

    EmitterSubscription

    Example

    const subscription = HyperTrack.subscribeToOrders(orders => {
    ...
    })

    // later, to stop listening
    subscription.remove()