mrousavy / nitro

🔥 Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI
https://nitro.margelo.com
MIT License
642 stars 22 forks source link

[IMPROVEMENT] Simplify Promise structure #339

Closed mrousavy closed 3 days ago

mrousavy commented 5 days ago

Currently, Promises are very C++ STL oriented (around std::future/std::promise).

Since we have a more callback based approach on iOS and Android, I should probably add a different Path to promises for those platforms that simplifies the structure a bit.

We don't need to run a synchronous wait on a waiter thread pool. Instead, we can probably just add the listeners to some Promise structure, and call back whenever we're ready. This could potentially speed up Promises even more to make them as fast as possible.

cc @grabbou