post-me

Home > post-me > LocalHandle > setEmitTransfer

LocalHandle.setEmitTransfer() method

Specify which parts of the payload of a given event should be transferred into the other context instead of cloned.

Signature:

setEmitTransfer<K extends keyof E>(eventName: K, transfer: (payload: E[K]) => Transferable[]): void;

Parameters

Parameter Type Description
eventName K The name of the method
transfer (payload: E[K]) => Transferable[] A function that takes as parameter the payload of an event, and returns a list of transferable objects.

Returns:

void

Remarks

You only need to call setEmitTransfer once per event type. After the transfer function is set, it will automatically be used every time a payload is attached to the specific event.