fakes

package
v0.0.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub is a fake implementation of Chrome's messaging APIs.

func NewHub

func NewHub() *Hub

NewHub returns a fake implementation of Chrome's messaging APIs.

func (*Hub) AddReceiver

func (m *Hub) AddReceiver(r Receiver)

AddReceiver adds a receiver to which messages should be delivered.

func (*Hub) Send

func (m *Hub) Send(ctx jsutil.AsyncContext, msg js.Value) (js.Value, error)

Send implements Sender.Send().

type Receiver

type Receiver interface {
	OnMessage(ctx jsutil.AsyncContext, header js.Value, sender js.Value) js.Value
}

Receiver defines methods sufficient to receive messages and send responses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL