You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need a way to receive the original return value of the underlying method, and then either keep that return value, mutate it, or replace it entirely with a different value.
Something to the effect of this:.
MethodInfomyMethod;varplug=Nasal.InstanceMethod<MyReturn>(myMethod).ReturnWrapped((objectinstance,MyReturnoriginalReturn,MyParamp1,MyParamp2)=>{// Do stuff, and either return `originalReturn` or some other valuereturn ...});
The text was updated successfully, but these errors were encountered:
I dug into this a bit more (documenting here so I don't forget).
The reason this is not possible with the current API is because when using a plug, it only registers a prefix (BaseMethodHandler.Patch). To be able to what is described above would mean one of two things:
Implicitly set the CallOriginal flag so that the original plugged method still gets called. We would the need to invoke the user provided delegate and replace the return value with the user provided value.
What is being described is the Postfix behavior. We could provide an API for getting access to this. This is probably the better solution.
I need a way to receive the original return value of the underlying method, and then either keep that return value, mutate it, or replace it entirely with a different value.
Something to the effect of this:.
The text was updated successfully, but these errors were encountered: