You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/09/19 17:17:45 UTC

[GitHub] awerlang commented on issue #49: CB-12815: (ios) Fix bug nativeCallback not executed when app is in background

awerlang commented on issue #49: CB-12815: (ios) Fix bug nativeCallback not executed when app is in background
URL: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/49#issuecomment-422885954
 
 
   > 
   > 
   > @jcesarmobile see the [JIRA Issue](https://issues.apache.org/jira/browse/CB-12815?focusedCommentId=16013887&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16013887). `process.nextTick`, `Promises` and `setTimeout` put the code into a the queue for the next process tick. This preserves the existing setTimeout behaviour that Apple has apparently suppressed for setTimeout.
   
   This is incorrect, the behavior is not preserved.
   
   Keep in mind that the code:
   
   ```
   Promise.resolve(cordova.callbackFromNative(callbackId, success, status, args, keepCallback));
   ```
   
   is the same as:
   
   ```
   const cb = cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
   Promise.resolve(cb);
   ```
   
   And equivalent to:
   
   ```
   const cb = cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
   setTimeout(function() {}, 0);
   ```
   
   To maintain the same behavior do this:
   
   ```
   Promise.resolve().then(function () {
       cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
   });
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org