I am passing a success callback to a Cordova plugin, as below,
function onSuccess (response) {
console.log('i = ' + this.i + ', response = ' + response);
}.bind ({i: i})
The value of i is not retained. What am I missing?
After hours of debugging, learned that the Cordova layer run-time session does not carry forward 'this'. So, when the callback is eventually run within a session of the Cordova layer, the 'this' is not what the bind value is, but the value then.
In short, what I was trying to do is not possible.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.