cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Grebnov (Akvelon)" <v-seg...@microsoft.com>
Subject Discussing CB-5806 [Windows8] Add keepCallback support to proxy
Date Mon, 20 Jan 2014 14:24:19 GMT
Hi,
I've just found out that due to current windows8 proxy implementation[1] plugins can't specify
keepCalback parameter since result of proxy function is always treated as resultant message
only. On other platforms we have options to also specify callbackId, custom callbackStatus
and keepCallback parameters.

I believe correct implementation way is treating callback result as plugin result object which
should include callbackId, status, keepCallback, message, etc ...but we can't change this
behavior right now since it will break all already implemented plugins. So I propose the following
two solutions:

1. add keepCallback as second optional parameter

            onSuccess = function (result, keepCallback) {
                cordova.callbackSuccess(callbackId,
                        {
                        status: cordova.callbackStatus.OK,
                        message: result,
                        keepCallback: keepCallback == true
                    });

  Usage:  onSuccess(res, true);  onSuccess(undefined, true);

 2. allow plugins to specify keepCallback as part of result
 
  onSuccess = function (result) {
                cordova.callbackSuccess(callbackId,
                        {
                        status: cordova.callbackStatus.OK,
                        message: result,
                        keepCallback: result && result.keepCallback == true
                    });

I personally prefer #1, Thoughts?

[1] https://github.com/apache/cordova-js/blob/master/src/windows8/exec.js#L57

PS. There is aame problem with callbackId

Thx!
Sergey
Mime
View raw message