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")) { if (!PhoneGap.hasResource("accelerometer")) {
PhoneGap.addResource("accelerometer"); PhoneGap.addResource("accelerometer");
Acceleration = function(x, y, z) { /** @constructor */
function Acceleration(x, y, z) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;

View File

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

View File

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

View File

@ -13,6 +13,7 @@ PhoneGap.addResource("file");
* This class provides some useful information about a file. * This class provides some useful information about a file.
* This is the fields returned when navigator.fileMgr.getFileProperties() * This is the fields returned when navigator.fileMgr.getFileProperties()
* is called. * is called.
* @constructor
*/ */
FileProperties = function(filePath) { FileProperties = function(filePath) {
this.filePath = filePath; this.filePath = filePath;
@ -23,11 +24,12 @@ FileProperties = function(filePath) {
/** /**
* Represents a single file. * Represents a single file.
* *
* name {DOMString} name of the file, without path information * @constructor
* fullPath {DOMString} the full path of the file, including the name * @param name {DOMString} name of the file, without path information
* type {DOMString} mime type * @param fullPath {DOMString} the full path of the file, including the name
* lastModifiedDate {Date} last modified date * @param type {DOMString} mime type
* size {Number} size of the file in bytes * @param lastModifiedDate {Date} last modified date
* @param size {Number} size of the file in bytes
*/ */
File = function(name, fullPath, type, lastModifiedDate, size) { File = function(name, fullPath, type, lastModifiedDate, size) {
this.name = name || null; this.name = name || null;
@ -37,7 +39,8 @@ File = function(name, fullPath, type, lastModifiedDate, size) {
this.size = size || 0; this.size = size || 0;
}; };
FileError = function() { /** @constructor */
function FileError() {
this.code = null; this.code = null;
}; };
@ -62,8 +65,9 @@ FileError.PATH_EXISTS_ERR = 12;
// File manager // File manager
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
FileMgr = function() { /** @constructor */
}; function FileMgr() {
}
FileMgr.prototype.getFileProperties = function(filePath) { FileMgr.prototype.getFileProperties = function(filePath) {
return PhoneGap.exec(null, null, "File", "getFileProperties", [filePath]); return PhoneGap.exec(null, null, "File", "getFileProperties", [filePath]);
@ -126,6 +130,7 @@ PhoneGap.addConstructor(function() {
* For Android: * For Android:
* The root directory is the root of the file system. * The root directory is the root of the file system.
* To read from the SD card, the file name is "sdcard/my_file.txt" * To read from the SD card, the file name is "sdcard/my_file.txt"
* @constructor
*/ */
FileReader = function() { FileReader = function() {
this.fileName = ""; this.fileName = "";
@ -379,6 +384,7 @@ FileReader.prototype.readAsArrayBuffer = function(file) {
* The root directory is the root of the file system. * The root directory is the root of the file system.
* To write to the SD card, the file name is "sdcard/my_file.txt" * To write to the SD card, the file name is "sdcard/my_file.txt"
* *
* @constructor
* @param file {File} File object containing file properties * @param file {File} File object containing file properties
* @param append if true write to the end of the file, otherwise overwrite the file * @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 // File error codes
@ -765,6 +772,7 @@ LocalFileSystem.prototype._castDate = function(pluginResult) {
/** /**
* Information about the state of the file or directory * Information about the state of the file or directory
* *
* @constructor
* {Date} modificationTime (readonly) * {Date} modificationTime (readonly)
*/ */
Metadata = function() { Metadata = function() {
@ -774,6 +782,7 @@ Metadata = function() {
/** /**
* Supplies arguments to methods that lookup or create files and directories * 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} create file or directory if it doesn't exist
* @param {boolean} exclusive if true the command will fail if the file or directory exists * @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 * An interface representing a file system
* *
* @constructor
* {DOMString} name the unique name of the file system (readonly) * {DOMString} name the unique name of the file system (readonly)
* {DirectoryEntry} root directory 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. * An interface representing a directory on the file system.
* *
* @constructor
* {boolean} isFile always false (readonly) * {boolean} isFile always false (readonly)
* {boolean} isDirectory always true (readonly) * {boolean} isDirectory always true (readonly)
* {DOMString} name of the directory, excluding the path leading to it (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. * An interface that lists the files and directories in a directory.
* @constructor
*/ */
DirectoryReader = function(fullPath){ function DirectoryReader(fullPath){
this.fullPath = fullPath || null; this.fullPath = fullPath || null;
}; };
@ -935,6 +947,7 @@ DirectoryReader.prototype.readEntries = function(successCallback, errorCallback)
/** /**
* An interface representing a directory on the file system. * An interface representing a directory on the file system.
* *
* @constructor
* {boolean} isFile always true (readonly) * {boolean} isFile always true (readonly)
* {boolean} isDirectory always false (readonly) * {boolean} isDirectory always false (readonly)
* {DOMString} name of the file, excluding the path leading to it (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. * FileTransfer uploads a file to a remote server.
* @constructor
*/ */
FileTransfer = function() {}; FileTransfer = function() {};
/** /**
* FileUploadResult * FileUploadResult
* @constructor
*/ */
FileUploadResult = function() { FileUploadResult = function() {
this.bytesSent = 0; this.bytesSent = 0;
@ -25,6 +27,7 @@ FileUploadResult = function() {
/** /**
* FileTransferError * FileTransferError
* @constructor
*/ */
FileTransferError = function() { FileTransferError = function() {
this.code = null; 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. * Options to customize the HTTP request used to upload files.
* @constructor
* @param fileKey {String} Name of file request parameter. * @param fileKey {String} Name of file request parameter.
* @param fileName {String} Filename to be used by the server. Defaults to image.jpg. * @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. * @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg.

View File

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

View File

@ -18,6 +18,7 @@ PhoneGap.mediaObjects = {};
/** /**
* Object that receives native callbacks. * Object that receives native callbacks.
* PRIVATE * PRIVATE
* @constructor
*/ */
PhoneGap.Media = function() {}; 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 * 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 src The file name or url to play
* @param successCallback The callback to be called when the file is done playing or recording. * @param successCallback The callback to be called when the file is done playing or recording.
* successCallback() - OPTIONAL * successCallback() - OPTIONAL
@ -174,8 +176,6 @@ Media.prototype.getDuration = function() {
/** /**
* Get position of audio. * Get position of audio.
*
* @return
*/ */
Media.prototype.getCurrentPosition = function(success, fail) { Media.prototype.getCurrentPosition = function(success, fail) {
PhoneGap.exec(success, fail, "Media", "getCurrentPositionAudio", [this.id]); 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. * This class provides access to notifications on the device.
* @constructor
*/ */
Notification = function() { Notification = function() {
}; };

View File

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

View File

@ -25,7 +25,8 @@ Position = function(coords, timestamp) {
this.timestamp = (timestamp !== 'undefined') ? timestamp : new Date().getTime(); 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. * The latitude of the position.
*/ */
@ -54,7 +55,7 @@ Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
* The altitude accuracy of the position. * The altitude accuracy of the position.
*/ */
this.altitudeAccuracy = (altacc !== 'undefined') ? altacc : null; this.altitudeAccuracy = (altacc !== 'undefined') ? altacc : null;
}; }
/** /**
* This class specifies the options for requesting position data. * 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. * Storage object that is called by native code when performing queries.
* PRIVATE METHOD * PRIVATE METHOD
* @constructor
*/ */
var DroidDB = function() { var DroidDB = function() {
this.queryQueue = {}; this.queryQueue = {};
@ -105,6 +106,7 @@ DroidDB.prototype.fail = function(reason, id) {
/** /**
* Transaction object * Transaction object
* PRIVATE METHOD * PRIVATE METHOD
* @constructor
*/ */
var DroidDB_Tx = function() { var DroidDB_Tx = function() {
@ -205,6 +207,7 @@ DroidDB_Tx.prototype.queryFailed = function(id, reason) {
* SQL query object * SQL query object
* PRIVATE METHOD * PRIVATE METHOD
* *
* @constructor
* @param tx The transaction object that this query belongs to * @param tx The transaction object that this query belongs to
*/ */
var DroidDB_Query = function(tx) { 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. * SQL result set that is returned to user.
* PRIVATE METHOD * PRIVATE METHOD
* @constructor
*/ */
DroidDB_Result = function() { DroidDB_Result = function() {
this.rows = new DroidDB_Rows(); this.rows = new DroidDB_Rows();
@ -268,6 +272,7 @@ DroidDB_Result = function() {
/** /**
* SQL result set object * SQL result set object
* PRIVATE METHOD * PRIVATE METHOD
* @constructor
*/ */
DroidDB_Rows = function() { DroidDB_Rows = function() {
this.resultSet = []; // results array this.resultSet = []; // results array
@ -305,6 +310,9 @@ DroidDB_openDatabase = function(name, version, display_name, size) {
* TODO: Do similar for sessionStorage. * TODO: Do similar for sessionStorage.
*/ */
/**
* @constructor
*/
var CupcakeLocalStorage = function() { var CupcakeLocalStorage = function() {
try { try {

View File

@ -47,9 +47,9 @@ class Create < Classic
@config[:icons] = {} @config[:icons] = {}
defaultIconSize = 0 defaultIconSize = 0
doc.root.elements.each do |n| doc.root.elements.each do |n|
@config[:name] = n.text.gsub('-','').gsub(' ','') if n.name == 'name' @config[:name] = n.text.gsub('-','').gsub(' ','') if n.name == 'name'
@config[:description] = n.text if n.name == 'description' @config[:description] = n.text if n.name == 'description'
@config[:content] = n.attributes["src"] if n.name == 'content' @config[:content] = n.attributes["src"] if n.name == 'content'
if n.name == 'icon' if n.name == 'icon'
if n.attributes["width"] == '72' && n.attributes["height"] == '72' if n.attributes["width"] == '72' && n.attributes["height"] == '72'
@config[:icons]["drawable-hdpi".to_sym] = n.attributes["src"] @config[:icons]["drawable-hdpi".to_sym] = n.attributes["src"]