@UiThread public static class WebExtension.Port extends Object
Modifier and Type | Field and Description |
---|---|
String |
name
The application identifier of the MessageDelegate that opened this port.
|
WebExtension.MessageSender |
sender
WebExtension.MessageSender corresponding to this port. |
Modifier | Constructor and Description |
---|---|
protected |
Port()
Override for tests.
|
Modifier and Type | Method and Description |
---|---|
void |
disconnect()
Disconnects this port and notifies the other end.
|
void |
postMessage(JSONObject message)
Post a message to the WebExtension connected to this
WebExtension.Port instance. |
void |
setDelegate(WebExtension.PortDelegate delegate)
Set a delegate for incoming messages through this
WebExtension.Port . |
@NonNull public final WebExtension.MessageSender sender
WebExtension.MessageSender
corresponding to this port.@NonNull public final String name
public void postMessage(@NonNull JSONObject message)
WebExtension.Port
instance.message
- JSONObject
that will be sent to the WebExtension.public void disconnect()
public void setDelegate(@Nullable WebExtension.PortDelegate delegate)
WebExtension.Port
.delegate
- Delegate that will receive messages sent through
this WebExtension.Port
.