In my current project, there is a code snippet that produces a JQuery promise:
const jqProm = server.downloadAsync();
I am interested in integrating this promise within an async function. I was thinking of creating something similar to the C# TaskCompletionSource, returning a placeholder Task (Promise), and using it as a handler to set the status of the dummy Task (Promise) based on the resolve/reject outcome of jqProm.
Is there a way to implement this? I have searched for a constructor that accepts resolver and rejector actions with no luck - it seems like there isn't anything equivalent to a PromiseCompletionSource.