You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Sergey Grebnov (Akvelon)" <v-...@microsoft.com> on 2014/01/20 15:24:19 UTC
Discussing CB-5806 [Windows8] Add keepCallback support to proxy
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