{dialog.object}_delayTillPhoneGapReady Method
Syntax
Arguments
- functionToExecutefunction
The name of a JavaScript function to call when Cordova is ready.
- scopeobject
If the functionToExecute is a method of an object, the object to call the method on.
- arguments
Description
Registers a function to call when Cordova is loaded and ready.
Discussion
Typically, when a need to execute a method that can only be run after Cordova has loaded, you add code to the onPhoneGap ready client-side event. But in some cases this is not practical and you might already have some code that runs in the onRenderComplete, or onPrepareComplete event and some of the methods in these events need to wait till Cordova is ready.
The {dialog.object}._delayTillPhoneGapReady() method allows you to register function calls that will only be made once Cordova is ready.
For example, say you wanted to call the List Object's ._fetchMediaFiles() method.
Normally your code would be:
var lObj = {dialog.object}.getControl('LISTNAME'); lObj._fetchMediaFiles();
This could be rewritten as
var lObj = {dialog.object}.getControl('LISTNAME'); {dialog.object}._delayTillPhoneGapReady(_fetchMediaFiles,lObj);