Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27483] iOS: code execution order in Promise

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 8.2.0
Fix Version/sn/a
ComponentsiOS
LabelsengSchedule, ios, promise
ReporterSergey Volkov
AssigneeVijay Singh
Created2019-10-03T15:03:15.000+0000
Updated2019-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

Comments

No comments

JSON Source