How to wait for a promise to be resolved?

后端 未结 1 945
无人及你
无人及你 2021-02-11 15:07

I\'m dealing with a NodeJs framework that requires a certain function to be synchronous, but I need to retrieve a value that can only be accessed asynchronously. In a perfect wo

相关标签:
1条回答
  • 2021-02-11 15:38

    Given that node is by default only single threaded there isn't really an easy way to solve this. There is one though. Bases on generators/fibers you can add a sort of concurrent execution to node. There is a waitfor implementation based on that.

    0 讨论(0)
提交回复
热议问题