This is not a direct answer to the question, but just for your reference.
The fetch
API can be executed directly in the browser, not just in a Node.js environment. You can call the fetch
API directly in MMM-MyModule.js
without needing node_helper.js
.
Additionally, since the fetch
API works asynchronously, you can manage the responses of two fetch calls as follows:
- If you need to use the response that arrives first, use
Promise.race()
or Promise.any()
.
- If you need to wait for both responses to arrive before proceeding, use
Promise.all()
.
Using these methods can help you manage data synchronization more efficiently.