-
Notifications
You must be signed in to change notification settings - Fork 38
API methods
PhoneGap desktop provides a number of methods to enable API functions to easily be simulated. They are divided up into three separate namespaces;
General helper methods that are not specific to phonegap desktop
Parameters; obj1 - object to copy to, obj2 - object to copy from
Perform a deep copy of properties from one object to another.
Parameters; left, top, width, height - %age dimensions of the popup, content - text to display in the popup, interval - length of time the message should be displayed, border - colour to use for the border, [callback] - optional function to call when message closes, [callbackParams] - parameters to pass to the callback function
Shows a simple popup message that closes after a short time.
Parameters; obj - the object to clone
Creates a new object that is clone of the passed in parameter
Objects that should not be created manually in code
Parameters; data - object of media properties Returns a media object for use by the PhoneGap capture function
Internal function to enable PhoneGap api calls to be simulated
Parameters; fileName - the json data file to read
The file in question will be merged with the current configuration
Parameters; nodeName - the section of the config file to use for this value, element - the element in the config file to use for this value
This function returns a value from the config file by use of section and element names.
If the found data is an array one value will be returned from it, otherwise the value itself will be returned. This allows API functions to return changing data (e.g. for accelerometer or gps readings)
Parameters; keyCode - the key pressed to trigger the event (e.g. 68 = D for Volume Down button)
Fires one of the PhoneGap phone events.
Parameters; sectionName - name of the section the exception relates to
Allows API functions to trigger random exceptions based on developer preference. e.g. gps function may regularly produce an error and this should be tested for. This can be configured globally or per section. See config page for more details.
Parameters; obj - the object to add the property to, debugElement - section in the config file the property value should come from, debugNode - the element to read the value from in the config file. Also used as the property name on obj. Binds a dynamic property (one whose value can change) to an object.
Parameters; successCallback - function to call when the interval elapses, errorCallback - function to call if an exception occurs, frequency - interval to use between each call, nodeName - section in the config file to read data from, elementName - element in the config file to read data for the successCallback, errorElement - element in the config file to read data for the errorCallback
Calls a function every x milliseconds. This returns an id for this interval function
Parameters; functionID - the id for the interval function to cancel.