Thanks, Looks good Sergey.


On Fri, Jan 24, 2014 at 5:33 AM, Sergey Grebnov (Akvelon) <
[email protected]> wrote:

> Here is the fix
> https://github.com/apache/cordova-js/pull/63/
>
> -Sergey
> -----Original Message-----
> From: Sergey Grebnov (Akvelon)
> Sent: Monday, January 20, 2014 6:24 PM
> To: '[email protected]'
> Subject: 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
>

Reply via email to