[TIMOB-27483] iOS: code execution order in Promise
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 8.2.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | engSchedule, ios, promise |
Reporter | Sergey Volkov |
Assignee | Vijay Singh |
Created | 2019-10-03T15:03:15.000+0000 |
Updated | 2019-10-22T18:07:09.000+0000 |
Description
Titanium SDK has a problem with correct code execution order on iOS in code like this:
Promise.resolve()
.then(() => console.log('A'));
console.log('B');
Correct output for this sample is:
{noformat}
B
A
{noformat}
new Promise(function(resolve, reject) {
setTimeout(function() {
console.log('1');
reject();
console.log('2');
}, 1000);
})
.then(function() {
console.log('3');
})
.catch(function() {
console.log('4');
})
Correct output for this sample is:
{noformat}
1
2
4
{noformat}
Tested on 8.2.0.GA and 8.3.0 (master branch).
I sent PR with additional test:
https://github.com/appcelerator/titanium_mobile/pull/11260
No comments