equal
deleted
inserted
replaced
|
1 if (typeof(DeviceInfo) != 'object') |
|
2 DeviceInfo = {}; |
|
3 |
|
4 /** |
|
5 * This represents the PhoneGap API itself, and provides a global namespace for accessing |
|
6 * information about the state of PhoneGap. |
|
7 * @class |
|
8 */ |
|
9 PhoneGap = { |
|
10 queue: { |
|
11 ready: true, |
|
12 commands: [], |
|
13 timer: null |
|
14 }, |
|
15 _constructors: [] |
|
16 }; |
|
17 |
|
18 /** |
|
19 * Boolean flag indicating if the PhoneGap API is available and initialized. |
|
20 */ |
|
21 PhoneGap.available = DeviceInfo.uuid != undefined; |
|
22 |
|
23 /** |
|
24 * Execute a PhoneGap command in a queued fashion, to ensure commands do not |
|
25 * execute with any race conditions, and only run when PhoneGap is ready to |
|
26 * recieve them. |
|
27 * @param {String} command Command to be run in PhoneGap, e.g. "ClassName.method" |
|
28 * @param {String[]} [args] Zero or more arguments to pass to the method |
|
29 */ |
|
30 PhoneGap.exec = function() { |
|
31 PhoneGap.queue.commands.push(arguments); |
|
32 if (PhoneGap.queue.timer == null) |
|
33 PhoneGap.queue.timer = setInterval(PhoneGap.run_command, 10); |
|
34 }; |
|
35 /** |
|
36 * Internal function used to dispatch the request to PhoneGap. This needs to be implemented per-platform to |
|
37 * ensure that methods are called on the phone in a way appropriate for that device. |
|
38 * @private |
|
39 */ |
|
40 PhoneGap.run_command = function() { |
|
41 }; |
|
42 |