Let's say there is an NPM module that I want to require
. This module is an async process, but it does not return a Promise
so I cannot await
on it and wait for the process to finish. Is there a way to wait for this script to finish, before continuing?
For example
// some 3rd party package
// it does not return a promise or anything
// But the function they call is async and will take time to complete
performAsyncOperation();
// In my application, I want to do
await require('the-3rd-party-package'); // <-- Wait for this to complete