Options
All
  • Public
  • Public/Protected
  • All
Menu

Ditto JS SDK v1.0.8

Index

Type aliases

ConditionSource

ConditionSource: "BLE" | "TCP" | "AWDL" | "MDNS"

The source for a transport condition.

CustomLogCallback

CustomLogCallback: (logLevel: LogLevel, message: string) => void

Type declaration

DocumentValue

DocumentValue: {}

A document value is a JavaScript object containing values for keys that can be serialized via CBOR.

Type declaration

Identity

The various identity configurations that you can use when initializing a Ditto instance. Currently supported are development, sharedKey, and production identities.

LiveQueryEvent

Represents events delivered by a LiveQuery, which can be initial (fired immediately upon registration) or an update (all subsequent events).

LogLevel

LogLevel: "Error" | "Warning" | "Info" | "Debug" | "Verbose"

The log levels supported by Ditto.

PresenceConnectionType

PresenceConnectionType: "WiFi" | "WebSocket" | "AWDL" | "BLE"

Types of connections that can be established between two peers.

QueryArguments

QueryArguments: {}

Represents a dictionary of values to be incorporated into a query keyed by the placeholder used within that query. See method find() of Collection for more info.

Type declaration

  • [key: string]: any

QueryObservationHandler

QueryObservationHandler: (documents: Document[], event: LiveQueryEvent, signalNext?: () => void) => void | Promise<void>

Type declaration

    • The closure that is called whenever the documents covered by a live query change.

      Parameters

      Returns void | Promise<void>

RemotePeer

RemotePeer: { approximateDistanceInMeters?: number; connections: PresenceConnectionType[]; deviceName: string; networkID: string; rssi?: number }

A peer object with information about an observed peer.

Type declaration

  • Optional approximateDistanceInMeters?: number
  • connections: PresenceConnectionType[]
  • deviceName: string
  • networkID: string
  • Optional rssi?: number

SingleObservationHandler

SingleObservationHandler: (document: Document | null, event: SingleDocumentLiveQueryEvent, signalNext?: () => void) => void | Promise<void>

Type declaration

SortDirection

SortDirection: "ascending" | "descending"

Describes the direction when sorting a query.

SubscriptionContextInfo

SubscriptionContextInfo: { collectionName: string; ditto: Ditto; query: string; queryArgsCBOR: Uint8Array | null }

Type declaration

  • collectionName: string
  • ditto: Ditto
  • query: string
  • queryArgsCBOR: Uint8Array | null

TransportCondition

TransportCondition: "Unknown" | "OK" | "GenericFailure" | "AppInBackground" | "MDNSFailure" | "TCPListenFailure" | "NoBLECentralPermission" | "NoBLEPeripheralPermission" | "CannotEstablishConnection" | "BLEDisabled" | "NoBLEHardware" | "WiFiDisabled" | "TemporarilyUnavailable"

Types of connections that can be established between two peers.

UpdateResultType

UpdateResultType: "set" | "replacedWithCounter" | "incremented" | "inserted" | "removed" | "pushed" | "popped"

The types of an UpdateResult.

Functions

init

  • init(options?: FFI.InitOptions): Promise<void>
  • Initializes the whole Ditto module. Needs to be called and complete before any of the Ditto API is used.

    Parameters

    • Optional options: FFI.InitOptions

      Dictionary with global initialization options. You can explicitly specify the webAssemblyModule or its location by passing the webAssemblyModule option.

    Returns Promise<void>