[ 
https://issues.apache.org/jira/browse/CB-5806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13878777#comment-13878777
 ] 

Sergey Grebnov commented on CB-5806:
------------------------------------

added additional info as per "Discussing CB-5806 [Windows8] Add keepCallback 
support to proxy"

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


> [Windows8] Add keepCallback support to proxy
> --------------------------------------------
>
>                 Key: CB-5806
>                 URL: https://issues.apache.org/jira/browse/CB-5806
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS, Windows 8
>    Affects Versions: 3.3.0
>            Reporter: Sergey Grebnov
>            Assignee: Sergey Grebnov
>
> Below is current proxy implementation. There is no way pass keepCallbck param 
> via onSuccess method.
>             onSuccess = function (result) {
>                 cordova.callbackSuccess(callbackId,
>                         {
>                         status: cordova.callbackStatus.OK,
>                         message: result
>                     });
>             };
>             onError = function (err) {
>                 cordova.callbackError(callbackId,
>                         {
>                         status: cordova.callbackStatus.ERROR,
>                         message: err
>                     });
>             };
>             proxy(onSuccess, onError, args);



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to