Documentation ¶
Index ¶
- func Pipe() (*MessagePort, *MessagePort)
- type MessagePort
- func (p *MessagePort) Close() error
- func (p *MessagePort) CloseWithError(err error)
- func (p *MessagePort) Read(b []byte) (n int, err error)
- func (p *MessagePort) ReadMessage() (js.Value, error)
- func (p *MessagePort) Write(b []byte) (n int, err error)
- func (p *MessagePort) WriteMessage(messages map[string]any, transferables []any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Pipe ¶
func Pipe() (*MessagePort, *MessagePort)
Pipe returns a synchronous duplex MessagePort pipe.
Types ¶
type MessagePort ¶
MessagePort is a synchronous JS MessagePort wrapper.
func NewMessagePort ¶
func NewMessagePort(value js.Value) *MessagePort
NewMessagePort creates a synchronous JS MessagePort wrapper.
func (*MessagePort) Close ¶
func (p *MessagePort) Close() error
Close the port. All pending reads and writes are unblocked and return io.ErrClosedPipe.
func (*MessagePort) CloseWithError ¶
func (p *MessagePort) CloseWithError(err error)
CloseWithError writes an error message into the port and closes the port. All pending reads and writes are unblocked and return io.ErrClosedPipe.
func (*MessagePort) Read ¶
func (p *MessagePort) Read(b []byte) (n int, err error)
Read a byte array message from the port.
func (*MessagePort) ReadMessage ¶
func (p *MessagePort) ReadMessage() (js.Value, error)
ReadMessage reads a single message or error from the port.
func (*MessagePort) Write ¶
func (p *MessagePort) Write(b []byte) (n int, err error)
Write a byte array message into the port.
func (*MessagePort) WriteMessage ¶
func (p *MessagePort) WriteMessage(messages map[string]any, transferables []any) error
WriteMessage writes a messages into the port. It blocks until the remote side reads the message.
Click to show internal directories.
Click to hide internal directories.