post-me

Home > post-me > LocalHandle > setReturnTransfer

LocalHandle.setReturnTransfer() method

Specify which parts of the return value of a given method call should be transferred into the other context instead of cloned.

Signature:

setReturnTransfer<K extends keyof M>(methodName: K, transfer: (result: InnerType<ReturnType<M[K]>>) => Transferable[]): void;

Parameters

Parameter Type Description
methodName K The name of the method
transfer (result: InnerType<ReturnType<M[K]>>) => Transferable[] A function that takes as parameter the return value of a method call, and returns a list of transferable objects.

Returns:

void

Remarks

You only need to call setReturnTransfer once per method. After the transfer function is set, it will automatically be used every time a value is returned by the specified method.