DefinitelyTyped

Index

Variables

Interfaces

Variables

Camera: Camera

This plugin provides an API for taking pictures and for choosing images from the system's image library.

public cleanup(onSuccess: () => void, onError: (message: string) => void)

Removes intermediate photos taken by the camera from temporary storage.

Parameters

  • onSuccess: () => void

    Success callback, that called when cleanup succeeds.

  • onError: (message: string) => void

    Error callback, that get an error message.

public getPicture(cameraSuccess: (data: string) => void, cameraError: (message: string) => void, cameraOptions?: CameraOptions)

Takes a photo using the camera, or retrieves a photo from the device's image gallery.

Parameters

  • cameraSuccess: (data: string) => void

    Success callback, that get the image as a base64-encoded String, or as the URI for the image file.

  • cameraError: (message: string) => void

    Error callback, that get an error message.

  • cameraOptions?: CameraOptions optional

    Optional parameters to customize the camera settings.

CaptureError: CaptureError

Encapsulates the error code resulting from a failed media capture operation.

public code: number

One of the pre-defined error codes listed below. CaptureError.CAPTURE_INTERNAL_ERR The camera or microphone failed to capture image or sound. CaptureError.CAPTURE_APPLICATION_BUSY The camera or audio capture application is currently serving another capture request. CaptureError.CAPTURE_INVALID_ARGUMENT Invalid use of the API (e.g., the value of limit is less than one). CaptureError.CAPTURE_NO_MEDIA_FILES The user exits the camera or audio capture application before capturing anything. CaptureError.CAPTURE_NOT_SUPPORTED The requested capture operation is not supported.

public message: string

CompassError: CompassError

A CompassError object is returned to the onError callback function when an error occurs.

public code: number

One of the predefined error codes CompassError.COMPASS_INTERNAL_ERR CompassError.COMPASS_NOT_SUPPORTED

Connection: Connection

The connection object, exposed via navigator.connection, provides information about the device's cellular and wifi connection.

public type: number

This property offers a fast way to determine the device's network connection state, and type of connection. One of: Connection.UNKNOWN Connection.ETHERNET Connection.WIFI Connection.CELL_2G Connection.CELL_3G Connection.CELL_4G Connection.CELL Connection.NONE

Contact: Contact

The Contact object represents a user's contact. Contacts can be created, stored, or removed from the device contacts database. Contacts can also be retrieved (individually or in bulk) from the database by invoking the navigator.contacts.find method.

optional public addresses?: ContactAddress[]

An array of all the contact's addresses.

optional public birthday?: Date

The birthday of the contact.

optional public categories?: ContactField[]

An array of all the user-defined categories associated with the contact.

optional public displayName?: string

The name of this Contact, suitable for display to end users.

optional public emails?: ContactField[]

An array of all the contact's email addresses.

optional public id?: string

A globally unique identifier.

optional public ims?: ContactField[]

An array of all the contact's IM addresses.

optional public name?: ContactName

An object containing all components of a persons name.

optional public nickname?: string

A casual name by which to address the contact.

optional public note?: string

A note about the contact.

optional public organizations?: ContactOrganization[]

An array of all the contact's organizations.

optional public phoneNumbers?: ContactField[]

An array of all the contact's phone numbers.

optional public photos?: ContactField[]

An array of the contact's photos.

optional public urls?: ContactField[]

An array of web pages associated with the contact.

public clone(): Contact

Returns a new Contact object that is a deep copy of the calling object, with the id property set to null

Returns

Contact

public remove(onSuccess: () => void, onError: (error: Error) => void)

Removes the contact from the device contacts database, otherwise executes an error callback with a ContactError object.

Parameters

  • onSuccess: () => void

    Success callback function invoked on success operation.

  • onError: (error: Error) => void

    Error callback function, invoked when an error occurs.

public save(onSuccess: (contact: Contact) => void, onError: (error: Error) => void)

Saves a new contact to the device contacts database, or updates an existing contact if a contact with the same id already exists.

Parameters

  • onSuccess: (contact: Contact) => void

    Success callback function invoked on success operation with che Contact object.

  • onError: (error: Error) => void

    Error callback function, invoked when an error occurs.

ContactAddress: ContactAddress

The ContactAddress object stores the properties of a single address of a contact. A Contact object may include more than one address in a ContactAddress[] array.

optional public country?: string

The country name.

optional public formatted?: string

The full address formatted for display.

optional public locality?: string

The city or locality.

optional public postalCode?: string

The zip code or postal code.

optional public pref?: boolean

Set to true if this ContactAddress contains the user's preferred value.

optional public region?: string

The state or region.

optional public streetAddress?: string

The full street address.

optional public type?: string

A string indicating what type of field this is, home for example.

ContactError: ContactError

The ContactError object is returned to the user through the contactError callback function when an error occurs.

public code: number

Error code

public message: string

Error message

ContactField: ContactField

The ContactField object is a reusable component that represents contact fields generically. Each ContactField object contains a value, type, and pref property. A Contact object stores several properties in ContactField[] arrays, such as phone numbers and email addresses.

In most instances, there are no pre-determined values for a ContactField object's type attribute. For example, a phone number can specify type values of home, work, mobile, iPhone, or any other value that is supported by a particular device platform's contact database. However, for the Contact photos field, the type field indicates the format of the returned image: url when the value attribute contains a URL to the photo image, or base64 when the value contains a base64-encoded image string.

public pref: boolean

Set to true if this ContactField contains the user's preferred value.

public type: string

A string that indicates what type of field this is, home for example.

public value: string

The value of the field, such as a phone number or email address.

ContactFindOptions: ContactFindOptions

Search options to filter navigator.contacts.

optional public filter?: string

The search string used to find navigator.contacts.

optional public multiple?: boolean

Determines if the find operation returns multiple navigator.contacts.

ContactName: ContactName

Contains different kinds of information about a Contact object's name.

optional public familyName?: string

The contact's family name.

optional public formatted?: string

The complete name of the contact.

optional public givenName?: string

The contact's given name.

optional public honorificPrefix?: string

The contact's prefix (example Mr. or Dr.)

optional public honorificSuffix?: string

The contact's suffix (example Esq.).

optional public middleName?: string

The contact's middle name.

ContactOrganization: ContactOrganization

The ContactOrganization object stores a contact's organization properties. A Contact object stores one or more ContactOrganization objects in an array.

optional public department?: string

The department the contract works for.

optional public name?: string

The name of the organization.

optional public pref?: boolean

Set to true if this ContactOrganization contains the user's preferred value.

optional public title?: string

The contact's title at the organization.

optional public type?: string

A string that indicates what type of field this is, home for example.

Database: Database

public displayName: string

public name: string

public size: number

public version: string

public readTransaction(callback: (transaction: SqlTransaction) => void, errorCallback?: (error: SqlError) => void, successCallback?: () => void)

Starts new transaction.

Parameters

  • callback: (transaction: SqlTransaction) => void

    Function, that will be called when transaction starts.

  • errorCallback?: (error: SqlError) => void optional

    Called, when Transaction fails.

  • successCallback?: () => void optional

    Called, when transaction committed.

public transaction(callback: (transaction: SqlTransaction) => void, errorCallback?: (error: SqlError) => void, successCallback?: () => void)

Starts new transaction.

Parameters

  • callback: (transaction: SqlTransaction) => void

    Function, that will be called when transaction starts.

  • errorCallback?: (error: SqlError) => void optional

    Called, when Transaction fails.

  • successCallback?: () => void optional

    Called, when transaction committed.

FileTransfer: FileTransfer

The FileTransfer object provides a way to upload files using an HTTP multi-part POST request, and to download files as well.

public onprogress: Function

Called with a ProgressEvent whenever a new chunk of data is transferred.

public abort()

Aborts an in-progress transfer. The onerror callback is passed a FileTransferError object which has an error code of FileTransferError.ABORT_ERR.

public download(source: string, target: string, successCallback: (fileEntry: FileEntry) => void, errorCallback: (error: FileTransferError) => void, options?: FileDownloadOptions, trustAllHosts?: boolean)

downloads a file from server.

Parameters

  • source: string

    URL of the server to download the file, as encoded by encodeURI().

  • target: string

    Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.

  • successCallback: (fileEntry: FileEntry) => void

    A callback that is passed a FileEntry object. (Function)

  • errorCallback: (error: FileTransferError) => void

    A callback that executes if an error occurs when retrieving the fileEntry. Invoked with a FileTransferError object.

  • options?: FileDownloadOptions optional

    Optional parameters.

  • trustAllHosts?: boolean optional

    Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.

public upload(fileURL: string, server: string, successCallback: (result: FileUploadResult) => void, errorCallback: (error: FileTransferError) => void, options?: FileUploadOptions, trustAllHosts?: boolean)

Sends a file to a server.

Parameters

  • fileURL: string

    Filesystem URL representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.

  • server: string

    URL of the server to receive the file, as encoded by encodeURI().

  • successCallback: (result: FileUploadResult) => void

    A callback that is passed a FileUploadResult object.

  • errorCallback: (error: FileTransferError) => void

    A callback that executes if an error occurs retrieving the FileUploadResult. Invoked with a FileTransferError object.

  • options?: FileUploadOptions optional

    Optional parameters.

  • trustAllHosts?: boolean optional

    Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.

FileTransferError: FileTransferError

A FileTransferError object is passed to an error callback when an error occurs.

public body: any

public code: number

One of the predefined error codes listed below. FileTransferError.FILE_NOT_FOUND_ERR FileTransferError.INVALID_URL_ERR FileTransferError.CONNECTION_ERR FileTransferError.ABORT_ERR

public http_status: number

HTTP status code. This attribute is only available when a response code is received from the HTTP connection.

public source: string

URL to the source.

public target: string

URL to the target.

GlobalizationError: GlobalizationError

An object representing a error from the Globalization API.

public code: number

One of the following codes representing the error type: GlobalizationError.UNKNOWN_ERROR: 0 GlobalizationError.FORMATTING_ERROR: 1 GlobalizationError.PARSING_ERROR: 2 GlobalizationError.PATTERN_ERROR: 3

public message: string

A text message that includes the error's explanation and/or details

SqlError: SqlError

public code: number

public message: string

SqlTransaction: SqlTransaction

public executeSql(sql: string, arguments?: Array<any>, successCallback?: (transaction: SqlTransaction, resultSet: SqlResultSet) => void, errorCallback?: (transaction: SqlTransaction, error: SqlError) => void)

Executes SQL statement via current transaction.

Parameters

  • sql: string

    SQL statement to execute.

  • arguments?: Array<any> optional

    SQL stetement arguments.

  • successCallback?: (transaction: SqlTransaction, resultSet: SqlResultSet) => void optional

    Called in case of query has been successfully done.

  • errorCallback?: (transaction: SqlTransaction, error: SqlError) => void optional

    Called, when query fails.

cordova: Cordova

Apache Cordova instance

device: Device