diff -r 000000000000 -r 54063d8b0412 js/phonegap.js.base --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/phonegap.js.base Tue Jul 06 11:31:19 2010 -0700 @@ -0,0 +1,42 @@ +if (typeof(DeviceInfo) != 'object') + DeviceInfo = {}; + +/** + * This represents the PhoneGap API itself, and provides a global namespace for accessing + * information about the state of PhoneGap. + * @class + */ +PhoneGap = { + queue: { + ready: true, + commands: [], + timer: null + }, + _constructors: [] +}; + +/** + * Boolean flag indicating if the PhoneGap API is available and initialized. + */ +PhoneGap.available = DeviceInfo.uuid != undefined; + +/** + * Execute a PhoneGap command in a queued fashion, to ensure commands do not + * execute with any race conditions, and only run when PhoneGap is ready to + * recieve them. + * @param {String} command Command to be run in PhoneGap, e.g. "ClassName.method" + * @param {String[]} [args] Zero or more arguments to pass to the method + */ +PhoneGap.exec = function() { + PhoneGap.queue.commands.push(arguments); + if (PhoneGap.queue.timer == null) + PhoneGap.queue.timer = setInterval(PhoneGap.run_command, 10); +}; +/** + * Internal function used to dispatch the request to PhoneGap. This needs to be implemented per-platform to + * ensure that methods are called on the phone in a way appropriate for that device. + * @private + */ +PhoneGap.run_command = function() { +}; +