Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24549] TiAPI: Add support for Promises

GitHub Issuen/a
TypeEpic
PriorityHigh
StatusResolved
ResolutionFixed
Resolution Date2020-12-09T17:25:05.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.0
ComponentsAndroid, iOS, Windows, Windows phone
Labelsn/a
ReporterHans Knöchel
AssigneeChristopher Williams
Created2017-04-01T19:01:59.000+0000
Updated2021-08-26T11:01:37.000+0000

Description

"The modern development world is highly asynchronous". I agree, so we should add support for promises that can be used from the JS world to improve the general callback structure. On the native side, we should a new class "TiPromise" that can be used in the SDK, native modules and Hyperloop to allow promises. I am not completely sure about the architecture so far, but we should definitely talk about it!

Comments

  1. Chris Barber 2017-04-03

    +1 for replacing all callback-based functions with Promise-based signatures, but this is such a major change that I think we should tackle this when we tackle Alloy v2.
  2. Rene Pot 2018-03-08

    This issue is resolved by TIMOB-24610
  3. Sergey Volkov 2018-11-26

    I think this issue should be reopened, because it was not about general Promise support (native or polyfills). It was about promise-based APIs vs callback-based, currently we still can not create native method which will return Promise to js side, all we have is old-school callback. -I have prepared POC for creating promise-based APIs for Android native modules:- * -[Branch](https://github.com/drauggres/titanium_mobile/commits/feature/promise-api)- * -[Builds](https://github.com/drauggres/titanium_mobile/releases/tag/v8.0.0.promise-preview)- -This is just proof-of-concept so I will not create PR from it (but feel free to use it if you'll find it worth).- -P.S. I don't think permissionRequest should reject Promise that was done only to show both resolving and rejection.- ---- I rethought everything above and cleaned up code: https://github.com/appcelerator/titanium_mobile/pull/10554
  4. Hans Knöchel 2018-11-27

    +1. While I would rather like to see full async/await support, this is a good step in that direction!
  5. Christopher Williams 2020-01-28

    Re-opening as the "duplicate" ticket doesn't actually resolve this.
  6. Christopher Williams 2020-10-16

    https://github.com/appcelerator/titanium_mobile/pull/10554
  7. Christopher Williams 2020-12-09

    merged to master for 10.0.0 target Note that QE did not formally FR this yet, but the test suite was modified to include some tests for a couple new Promise-based APIs

JSON Source