Home > post-me > LocalHandle > setEmitTransfer
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;
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
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.