let resolveRef;
const promise = new Promise((res) => { resolveRef = res; });
const callback = (data) => {
// Do work...
resolveRef(data); // This "triggers" the await
};
Object.assign(callback, promise);
There’s a real performance cost to awaiting a fake Promise though, like `await regularPromise` bypasses the actual thenable stuff.