Is there some way to distinguish a request for the then
function (or its call) from await
?
I would like to do something like this:
var myProxy = new Proxy(myPromise, {
get: (t, k) => {
if (k == 'then') {
if (/* from await? */) console.log('from await')
else console.log('without await')
}
}
});
Essentially, I need to distinguish between the following two options for calling then
:
var a = await myProxy;
var b = myProxy.then(res => /* something */);