Update PhoneGap definitions and tests

This commit is contained in:
Boris Yankov
2012-11-05 04:19:08 +02:00
parent 185f815b8b
commit 4cfd38ca15
3 changed files with 563 additions and 1 deletions
+226
View File
@@ -48,7 +48,233 @@ interface Camera {
cleanup(cameraSuccess: (imageData: string) => void , cameraError: (message: string) => void ): void;
}
interface CaptureAudioOptions {
limit: number;
duration: number;
mode: number;
}
interface MediaFile {
name: string;
fullPath: string;
type: string;
lastModifiedDate: Date;
size: number;
getFormatData(successCallback: Function, errorCallback?: Function): void;
}
interface Capture {
captureAudio(captureSuccess: (mediaFiles: MediaFile[]) => void , captureError: (error: CaptureError) =>void , options?: CaptureAudioOptions);
}
interface CompassOptions {
frequency?: number;
filter?: number;
}
interface CompassHeading {
magneticHeading?: number;
trueHeading?: number;
headingAccuracy?: number;
timestamp?: number;
}
interface CompassError {
code: number;
}
interface Compass {
getCurrentHeading(compassSuccess: (heading: CompassHeading) => void , compassError: (error: CompassError) => void , compassOptions?: CompassOptions): void;
watchHeading(compassSuccess: (heading: CompassHeading) => void , compassError: (error: CompassError) => void , compassOptions?: CompassOptions): void;
clearWatch(watchID: number): void;
}
interface Connection {
type: number;
}
interface ContactAddress {
pref: bool;
type: string;
formatted: string;
streetAddress: string;
locality: string;
region: string;
postalCode: string;
country: string;
}
interface ContactField {
type: string;
value: string;
pref: bool;
}
interface Contact {
id: string;
displayName: string;
name: ContactName;
nickname: string;
phoneNumbers: ContactField[];
emails: ContactField[];
addresses: ContactAddress[];
ims: ContactField[];
organizations: ContactOrganization[];
birthday: Date;
note: string;
photos: ContactField[];
categories: ContactField[];
urls: ContactField[];
}
interface ContactFindOptions {
filter?: string;
multiple?: bool;
}
interface ContactName {
formatted: string;
familyName: string;
givenName: string;
middleName: string;
honorificPrefix: string;
honorificSuffix: string;
}
interface ContactOrganization {
pref: bool;
type: string;
name: string;
department: string;
title: string;
}
interface ContactError {
code: number;
}
interface Contacts {
create(properties: any): void;
find(contactFields: string[], contactSuccess: (contacts: Contact[]) => void , contactError: (error: ContactError) => void , contactFindOptions?: ContactFindOptions): void;
}
interface Device {
name: string;
cordova: string;
platform: string;
uuid: string;
version: string;
}
interface File {
}
interface GeolocationOptions {
enableHighAccuracy: bool;
timeout: number;
maximumAge: number;
}
interface Geolocation {
getCurrentPosition(geolocationSuccess: (position: Position) => void , geolocationError?: PositionErrorCallback, geolocationOptions?: GeolocationOptions): void;
watchPosition(geolocationSuccess: (position: Position) => void , geolocationError?: PositionErrorCallback, geolocationOptions?: GeolocationOptions): void;
clearWatch(watchID: number): void;
}
interface GlobalizationError {
code: number;
message: string;
}
interface Globalization {
getPreferredLanguage(successCB, errorCB): void;
getLocaleName(successCB, errorCB): void;
dateToString(date, successCB, errorCB, options): void;
stringToDate(dateString, successCB, errorCB, options): void;
getDatePattern(successCB, errorCB, options): void;
getDateNames(successCB, errorCB, options): void;
isDayLightSavingsTime(date, successCB, errorCB): void;
getFirstDayOfWeek(successCB, errorCB): void;
numberToString(number, successCB, errorCB, options): void;
stringToNumber(string, successCB, errorCB, options): void;
getNumberPattern(successCB, errorCB, options): void;
getCurrencyPattern(currencyCode, successCB, errorCB): void;
}
interface Media {
new (src: string, mediaSuccess: Function, mediaError?: MediaError, mediaStatus?: Function);
getCurrentPosition(mediaSuccess: Function, mediaError?: MediaError): void;
getDuration(): void;
play(): void;
pause(): void;
release(): void;
seekTo(milliseconds: number): void;
startRecord(): void;
stopRecord(): void;
stop(): void;
}
interface Notification {
alert(message: string, alertCallback: Function, title?: string, buttonName?: string): void;
confirm(message: string, confirmCallback: Function, title?: string, buttonLabels?: string): void;
beep(times: number): void;
vibrate(milliseconds: number): void;
}
interface Splashscreen {
show(): void;
hide(): void;
}
interface Database {
transaction();
changeVersion();
}
interface SQLResultSetRowList {
length: number;
item(index: number): any;
}
interface SQLError {
code: number;
message: string;
}
interface SQLResultSet {
insertId: number;
rowsAffected: number;
rows: SQLResultSetRowList;
}
interface SQLTransaction {
executeSql(sql: string): SQLResultSet;
}
interface LocalStorage {
key;
getItem;
setItem;
removeItem;
clear;
}
interface NavigatorPhonegap {
accelerometer: Accelerometer;
camera: Camera;
capture: Capture;
compass: Compass;
connection: Connection;
contacts: Contacts;
device: Device;
geolocation: Geolocation;
globalization: Globalization;
notification: Notification;
splashscreen: Splashscreen;
}
interface WindowPhonegap {
openDatabase(database_name: string, database_version: string, database_displayname: string, database_size: number): Database;
localStorage: LocalStorage;
}