Closed santhoshsk1918 closed 6 years ago
Hi @santhoshsk1918. Meld doesn't provide builtin async advice. That basically means meld doesn't treat promises specially, i.e. the promise (rather than the promise's fulfillment value) is the return value. You can, however build your own async advices on top of the functions meld provides.
Here's a very simple example of how you might implement your own "after fulfilling" advice:
function afterFulfilling (target, method, advice) {
function applyAfterFulfilling (joinpoint) {
const resultPromise = joinpoint.proceed()
return resultPromise
.then(advice)
// Then next line prevents advice from changing the return value,
// while still preserving the promise chain and surfacing errors.
// Feel free to drop it if you *want* to be able to change the return value.
.then(() => resultPromise)
}
return meld.around(target, method, applyAfterFulfilling)
}
Hope that helps!
AfterReturning and After is getting called when promise is in pending State before it reaches fulfilled or rejected State
In my method abc i am calling an other promise waiting for it resolve and then resolve this