callWithoutWaiting
Calls a function asynchronously in a Cordova plugin, without waiting for a result.
Syntax
ui.Interface.frontCall("cordova", "callWithoutWaiting",
[plugin-name, function-name [, param1, param2, ... ] ],
[callback-id])
- plugin-name - This is the name of the Cordova plugin.
- function-name - This is the name of plugin function to be called.
- param1, param2, ... - Optional parameters to be passed to the Cordova function.
- callback-id - Holds the callback identifier for this Cordova asynchroneous front call.
Usage
The callWithoutWaiting
front call executes asynchronously the Cordova plugin
function identified by the plugin-name and the
function-name.
The other arguments (param1, param2, …) are arguments for
the Cordova plugin function. Each argument may have a different type like FLOAT
,
INTEGER
, STRING
, RECORD
or DYNAMIC
ARRAY
(for RECORD
and DYNAMIC ARRAY
, the runtime system
will do the BDL to JSON conversion automatically).
The callWithoutWaiting
front call behaves the same as the call
front call, but does not wait for a result from the plugin. Instead it returns directly a unique
callback ID, to be able to identify the call later on. The program execution can continue, while the
plugin processes the result asynchronously.
When the plugin produces the result, it is stored internally by GMI/GMA in a result queue. Then
result data can be retrieved with getCallbackData
/getAllCallbackData
front calls in conjunction with the
"cordovacallback
" action.
When the current dialog contains an ON ACTION
handler for the cordovacallback
predefined
action, this action is triggered by the front end to notify the Genero program that there is
plugin data to fetch.
cordovacallback
action is triggered:- If the result queue is empty, and a result is added to the queue.
- If a new dialog that contains this action is entered or re-entered, and the result queue is non empty.
TRY/CATCH
or WHENEVER ERROR
.err_get()
function, to identify the reason of the error. For more details about
front call error handling, see ui.Interface.frontCall()
.Example
DEFINE id, song STRING
CALL ui.interface.frontcall( "cordova", "callWithoutWaiting",
["Media", "play", song], [id] )
...
ON ACTION cordovacallback ATTRIBUTE(DEFAULTVIEW=NO)
-- Process results
...