Home > post-me > LocalHandle
A handle to the local end of the connection
Signature:
export interface LocalHandle<M extends MethodsType = any, E extends EventsType = any>
Use this handle to:
Emit custom events to the other end
Set the methods that are exposed to the other end
Method | Description |
---|---|
emit(eventName, data, options) | Emit a custom event with a payload. The event can be captured by the other context. |
setEmitTransfer(eventName, transfer) | Specify which parts of the payload of a given event should be transferred into the other context instead of cloned. |
setMethod(methodName, method) | Set a specific method that will be exposed to the other end of the connection. |
setMethods(methods) | Set the methods that will be exposed to the other end of the connection. |
setReturnTransfer(methodName, transfer) | Specify which parts of the return value of a given method call should be transferred into the other context instead of cloned. |