Package org.mozilla.geckoview
Class WebExtension.Port
Object
org.mozilla.geckoview.WebExtension.Port
- Enclosing class:
- WebExtension
Port object that can be used for bidirectional communication with a WebExtension.
See also: WebExtensions/API/runtime/Port .
-
Field Summary
Modifier and TypeFieldDescriptionfinal String
The application identifier of the MessageDelegate that opened this port.WebExtension.MessageSender
corresponding to this port. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Disconnects this port and notifies the other end.void
postMessage
(JSONObject message) Post a message to the WebExtension connected to thisWebExtension.Port
instance.void
setDelegate
(WebExtension.PortDelegate delegate) Set a delegate for incoming messages through thisWebExtension.Port
.
-
Field Details
-
sender
WebExtension.MessageSender
corresponding to this port. -
name
The application identifier of the MessageDelegate that opened this port.
-
-
Constructor Details
-
Port
protected Port()Override for tests.
-
-
Method Details
-
postMessage
Post a message to the WebExtension connected to thisWebExtension.Port
instance.- Parameters:
message
-JSONObject
that will be sent to the WebExtension.
-
disconnect
public void disconnect()Disconnects this port and notifies the other end. -
setDelegate
Set a delegate for incoming messages through thisWebExtension.Port
.- Parameters:
delegate
- Delegate that will receive messages sent through thisWebExtension.Port
.
-