Add docs and fixed to pass through the Google Closure Compiler without warnings

This commit is contained in:
defrex 2011-03-30 12:14:21 -04:00 committed by Fil Maj
parent bdadbbc339
commit bde59adc04
14 changed files with 210 additions and 168 deletions

View File

@ -9,7 +9,8 @@
if (!PhoneGap.hasResource("accelerometer")) {
PhoneGap.addResource("accelerometer");
Acceleration = function(x, y, z) {
/** @constructor */
function Acceleration(x, y, z) {
this.x = x;
this.y = y;
this.z = z;

View File

@ -11,6 +11,7 @@ PhoneGap.addResource("app");
/**
* Constructor
* @constructor
*/
App = function() {};

View File

@ -11,22 +11,23 @@ PhoneGap.addResource("contact");
/**
* Contains information about a single contact.
* @constructor
* @param {DOMString} id unique identifier
* @param {DOMString} displayName
* @param {ContactName} name
* @param {DOMString} nickname
* @param {ContactField[]} phoneNumbers array of phone numbers
* @param {ContactField[]} emails array of email addresses
* @param {ContactAddress[]} addresses array of addresses
* @param {ContactField[]} ims instant messaging user ids
* @param {ContactOrganization[]} organizations
* @param {Array.<ContactField>} phoneNumbers array of phone numbers
* @param {Array.<ContactField>} emails array of email addresses
* @param {Array.<ContactAddress>} addresses array of addresses
* @param {Array.<ContactField>} ims instant messaging user ids
* @param {Array.<ContactOrganization>} organizations
* @param {DOMString} revision date contact was last updated
* @param {DOMString} birthday contact's birthday
* @param {DOMString} gender contact's gender
* @param {DOMString} note user notes about contact
* @param {ContactField[]} photos
* @param {ContactField[]} categories
* @param {ContactField[]} urls contact's web sites
* @param {Array.<ContactField>} photos
* @param {Array.<ContactField>} categories
* @param {Array.<ContactField>} urls contact's web sites
* @param {DOMString} timezone the contacts time zone
*/
var Contact = function (id, displayName, name, nickname, phoneNumbers, emails, addresses,
@ -53,7 +54,8 @@ var Contact = function (id, displayName, name, nickname, phoneNumbers, emails, a
/**
* ContactError.
* An error code assigned by an implementation when an error has occurred
* An error code assigned by an implementation when an error has occurreds
* @constructor
*/
var ContactError = function() {
this.code=null;
@ -152,6 +154,7 @@ Contact.prototype.save = function(successCB, errorCB) {
/**
* Contact name.
* @constructor
* @param formatted
* @param familyName
* @param givenName
@ -170,6 +173,7 @@ var ContactName = function(formatted, familyName, givenName, middle, prefix, suf
/**
* Generic contact field.
* @constructor
* @param {DOMString} id unique identifier, should only be set by native code
* @param type
* @param value
@ -184,6 +188,7 @@ var ContactField = function(type, value, pref) {
/**
* Contact address.
* @constructor
* @param {DOMString} id unique identifier, should only be set by native code
* @param formatted
* @param streetAddress
@ -204,6 +209,7 @@ var ContactAddress = function(formatted, streetAddress, locality, region, postal
/**
* Contact organization.
* @constructor
* @param {DOMString} id unique identifier, should only be set by native code
* @param name
* @param dept
@ -222,6 +228,7 @@ var ContactOrganization = function(name, dept, title) {
/**
* Represents a group of Contacts.
* @constructor
*/
var Contacts = function() {
this.inProgress = false;
@ -277,6 +284,7 @@ Contacts.prototype.cast = function(pluginResult) {
/**
* ContactFindOptions.
* @constructor
* @param filter used to match contacts against
* @param multiple boolean used to determine if more than one contact should be returned
* @param updatedSince return only contact records that have been updated on or after the given time

View File

@ -11,6 +11,9 @@
if (!PhoneGap.hasResource("crypto")) {
PhoneGap.addResource("crypto");
/**
* @constructor
*/
var Crypto = function() {
};

View File

@ -13,6 +13,7 @@ PhoneGap.addResource("file");
* This class provides some useful information about a file.
* This is the fields returned when navigator.fileMgr.getFileProperties()
* is called.
* @constructor
*/
FileProperties = function(filePath) {
this.filePath = filePath;
@ -23,11 +24,12 @@ FileProperties = function(filePath) {
/**
* Represents a single file.
*
* name {DOMString} name of the file, without path information
* fullPath {DOMString} the full path of the file, including the name
* type {DOMString} mime type
* lastModifiedDate {Date} last modified date
* size {Number} size of the file in bytes
* @constructor
* @param name {DOMString} name of the file, without path information
* @param fullPath {DOMString} the full path of the file, including the name
* @param type {DOMString} mime type
* @param lastModifiedDate {Date} last modified date
* @param size {Number} size of the file in bytes
*/
File = function(name, fullPath, type, lastModifiedDate, size) {
this.name = name || null;
@ -37,7 +39,8 @@ File = function(name, fullPath, type, lastModifiedDate, size) {
this.size = size || 0;
};
FileError = function() {
/** @constructor */
function FileError() {
this.code = null;
};
@ -62,8 +65,9 @@ FileError.PATH_EXISTS_ERR = 12;
// File manager
//-----------------------------------------------------------------------------
FileMgr = function() {
};
/** @constructor */
function FileMgr() {
}
FileMgr.prototype.getFileProperties = function(filePath) {
return PhoneGap.exec(null, null, "File", "getFileProperties", [filePath]);
@ -126,6 +130,7 @@ PhoneGap.addConstructor(function() {
* For Android:
* The root directory is the root of the file system.
* To read from the SD card, the file name is "sdcard/my_file.txt"
* @constructor
*/
FileReader = function() {
this.fileName = "";
@ -379,6 +384,7 @@ FileReader.prototype.readAsArrayBuffer = function(file) {
* The root directory is the root of the file system.
* To write to the SD card, the file name is "sdcard/my_file.txt"
*
* @constructor
* @param file {File} File object containing file properties
* @param append if true write to the end of the file, otherwise overwrite the file
*/
@ -640,7 +646,8 @@ FileWriter.prototype.truncate = function(size) {
);
};
LocalFileSystem = function() {
/** @constructor */
function LocalFileSystem() {
};
// File error codes
@ -765,6 +772,7 @@ LocalFileSystem.prototype._castDate = function(pluginResult) {
/**
* Information about the state of the file or directory
*
* @constructor
* {Date} modificationTime (readonly)
*/
Metadata = function() {
@ -774,6 +782,7 @@ Metadata = function() {
/**
* Supplies arguments to methods that lookup or create files and directories
*
* @constructor
* @param {boolean} create file or directory if it doesn't exist
* @param {boolean} exclusive if true the command will fail if the file or directory exists
*/
@ -785,6 +794,7 @@ Flags = function(create, exclusive) {
/**
* An interface representing a file system
*
* @constructor
* {DOMString} name the unique name of the file system (readonly)
* {DirectoryEntry} root directory of the file system (readonly)
*/
@ -796,6 +806,7 @@ FileSystem = function() {
/**
* An interface representing a directory on the file system.
*
* @constructor
* {boolean} isFile always false (readonly)
* {boolean} isDirectory always true (readonly)
* {DOMString} name of the directory, excluding the path leading to it (readonly)
@ -917,8 +928,9 @@ DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCall
/**
* An interface that lists the files and directories in a directory.
* @constructor
*/
DirectoryReader = function(fullPath){
function DirectoryReader(fullPath){
this.fullPath = fullPath || null;
};
@ -935,6 +947,7 @@ DirectoryReader.prototype.readEntries = function(successCallback, errorCallback)
/**
* An interface representing a directory on the file system.
*
* @constructor
* {boolean} isFile always true (readonly)
* {boolean} isDirectory always false (readonly)
* {DOMString} name of the file, excluding the path leading to it (readonly)

View File

@ -11,11 +11,13 @@ PhoneGap.addResource("filetransfer");
/**
* FileTransfer uploads a file to a remote server.
* @constructor
*/
FileTransfer = function() {};
/**
* FileUploadResult
* @constructor
*/
FileUploadResult = function() {
this.bytesSent = 0;
@ -25,6 +27,7 @@ FileUploadResult = function() {
/**
* FileTransferError
* @constructor
*/
FileTransferError = function() {
this.code = null;
@ -67,6 +70,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
/**
* Options to customize the HTTP request used to upload files.
* @constructor
* @param fileKey {String} Name of file request parameter.
* @param fileName {String} Filename to be used by the server. Defaults to image.jpg.
* @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg.

View File

@ -25,6 +25,7 @@ Geolocation = function() {
/**
* Position error object
*
* @constructor
* @param code
* @param message
*/

View File

@ -18,6 +18,7 @@ PhoneGap.mediaObjects = {};
/**
* Object that receives native callbacks.
* PRIVATE
* @constructor
*/
PhoneGap.Media = function() {};
@ -66,6 +67,7 @@ PhoneGap.Media.onStatus = function(id, msg, value) {
/**
* This class provides access to the device media, interfaces to both sound and video
*
* @constructor
* @param src The file name or url to play
* @param successCallback The callback to be called when the file is done playing or recording.
* successCallback() - OPTIONAL
@ -174,8 +176,6 @@ Media.prototype.getDuration = function() {
/**
* Get position of audio.
*
* @return
*/
Media.prototype.getCurrentPosition = function(success, fail) {
PhoneGap.exec(success, fail, "Media", "getCurrentPositionAudio", [this.id]);

View File

@ -11,6 +11,7 @@ PhoneGap.addResource("notification");
/**
* This class provides access to notifications on the device.
* @constructor
*/
Notification = function() {
};

View File

@ -76,6 +76,7 @@ PhoneGap.addResource = function(name) {
/**
* Custom pub-sub channel that can have functions subscribed to it
* @constructor
*/
PhoneGap.Channel = function (type)
{
@ -432,7 +433,7 @@ PhoneGap.fireEvent = function(type) {
* The restriction on ours is that it must be an array of simple types.
*
* @param args
* @return
* @return {String}
*/
PhoneGap.stringify = function(args) {
if (typeof JSON === "undefined") {
@ -464,7 +465,7 @@ PhoneGap.stringify = function(args) {
// don't copy the functions
s = s + '""';
} else if (args[i][name] instanceof Object) {
s = s + this.stringify(args[i][name]);
s = s + PhoneGap.stringify(args[i][name]);
} else {
s = s + '"' + args[i][name] + '"';
}
@ -490,7 +491,7 @@ PhoneGap.stringify = function(args) {
* Does a deep clone of the object.
*
* @param obj
* @return
* @return {Object}
*/
PhoneGap.clone = function(obj) {
var i, retVal;
@ -555,7 +556,7 @@ PhoneGap.callbackStatus = {
* @param {Function} fail The fail callback
* @param {String} service The name of the service to use
* @param {String} action Action to be run in PhoneGap
* @param {String[]} [args] Zero or more arguments to pass to the method
* @param {Array.<String>} [args] Zero or more arguments to pass to the method
*/
PhoneGap.exec = function(success, fail, service, action, args) {
try {
@ -564,7 +565,7 @@ PhoneGap.exec = function(success, fail, service, action, args) {
PhoneGap.callbacks[callbackId] = {success:success, fail:fail};
}
var r = prompt(this.stringify(args), "gap:"+this.stringify([service, action, callbackId, true]));
var r = prompt(PhoneGap.stringify(args), "gap:"+PhoneGap.stringify([service, action, callbackId, true]));
// If a result was returned
if (r.length > 0) {
@ -874,7 +875,7 @@ PhoneGap.JSCallbackPolling = function() {
/**
* Create a UUID
*
* @return
* @return {String}
*/
PhoneGap.createUUID = function() {
return PhoneGap.UUIDcreatePart(4) + '-' +

View File

@ -25,7 +25,8 @@ Position = function(coords, timestamp) {
this.timestamp = (timestamp !== 'undefined') ? timestamp : new Date().getTime();
};
Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
/** @constructor */
function Coordinates(lat, lng, alt, acc, head, vel, altacc) {
/**
* The latitude of the position.
*/
@ -54,7 +55,7 @@ Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
* The altitude accuracy of the position.
*/
this.altitudeAccuracy = (altacc !== 'undefined') ? altacc : null;
};
}
/**
* This class specifies the options for requesting position data.

View File

@ -18,6 +18,7 @@ PhoneGap.addResource("storage");
/**
* Storage object that is called by native code when performing queries.
* PRIVATE METHOD
* @constructor
*/
var DroidDB = function() {
this.queryQueue = {};
@ -105,6 +106,7 @@ DroidDB.prototype.fail = function(reason, id) {
/**
* Transaction object
* PRIVATE METHOD
* @constructor
*/
var DroidDB_Tx = function() {
@ -205,6 +207,7 @@ DroidDB_Tx.prototype.queryFailed = function(id, reason) {
* SQL query object
* PRIVATE METHOD
*
* @constructor
* @param tx The transaction object that this query belongs to
*/
var DroidDB_Query = function(tx) {
@ -260,6 +263,7 @@ DroidDB_Tx.prototype.executeSql = function(sql, params, successCallback, errorCa
/**
* SQL result set that is returned to user.
* PRIVATE METHOD
* @constructor
*/
DroidDB_Result = function() {
this.rows = new DroidDB_Rows();
@ -268,6 +272,7 @@ DroidDB_Result = function() {
/**
* SQL result set object
* PRIVATE METHOD
* @constructor
*/
DroidDB_Rows = function() {
this.resultSet = []; // results array
@ -305,6 +310,9 @@ DroidDB_openDatabase = function(name, version, display_name, size) {
* TODO: Do similar for sessionStorage.
*/
/**
* @constructor
*/
var CupcakeLocalStorage = function() {
try {