Dart Documentationchrome.runtimePort

Port class

An object which allows two way communication with other pages.

class Port extends ChromeObject {
 Port({String name, var disconnect, ChromeEvent onDisconnect, ChromeEvent onMessage, var postMessage, MessageSender sender}) {
   if (name != null) this.name = name;
   if (disconnect != null) this.disconnect = disconnect;
   if (onDisconnect != null) this.onDisconnect = onDisconnect;
   if (onMessage != null) this.onMessage = onMessage;
   if (postMessage != null) this.postMessage = postMessage;
   if (sender != null) this.sender = sender;
 }
 Port.fromProxy(JsObject jsProxy): super.fromProxy(jsProxy);

 String get name => jsProxy['name'];
 set name(String value) => jsProxy['name'] = value;

 dynamic get disconnect => jsProxy['disconnect'];
 set disconnect(var value) => jsProxy['disconnect'] = jsify(value);

 ChromeEvent get onDisconnect => _createEvent(jsProxy['onDisconnect']);
 set onDisconnect(ChromeEvent value) => jsProxy['onDisconnect'] = jsify(value);

 ChromeEvent get onMessage => _createEvent(jsProxy['onMessage']);
 set onMessage(ChromeEvent value) => jsProxy['onMessage'] = jsify(value);

 dynamic get postMessage => jsProxy['postMessage'];
 set postMessage(var value) => jsProxy['postMessage'] = jsify(value);

 /**
  * This property will <b>only</b> be present on ports passed to
  * onConnect/onConnectExternal listeners.
  */
 MessageSender get sender => _createMessageSender(jsProxy['sender']);
 set sender(MessageSender value) => jsProxy['sender'] = jsify(value);
}

Extends

ChromeObject > Port

Constructors

new Port({String name, disconnect, ChromeEvent onDisconnect, ChromeEvent onMessage, postMessage, MessageSender sender}) #

Create a new instance of a ChromeObject, which creates and delegates to a JsObject proxy.

docs inherited from ChromeObject
Port({String name, var disconnect, ChromeEvent onDisconnect, ChromeEvent onMessage, var postMessage, MessageSender sender}) {
 if (name != null) this.name = name;
 if (disconnect != null) this.disconnect = disconnect;
 if (onDisconnect != null) this.onDisconnect = onDisconnect;
 if (onMessage != null) this.onMessage = onMessage;
 if (postMessage != null) this.postMessage = postMessage;
 if (sender != null) this.sender = sender;
}

new Port.fromProxy(JsObject jsProxy) #

Create a new instance of a ChromeObject, which delegates to the given JsObject proxy.

docs inherited from ChromeObject
Port.fromProxy(JsObject jsProxy): super.fromProxy(jsProxy);

Properties

var disconnect #

dynamic get disconnect => jsProxy['disconnect'];
set disconnect(var value) => jsProxy['disconnect'] = jsify(value);

final jsProxy #

inherited from ChromeObject
final dynamic jsProxy

String name #

String get name => jsProxy['name'];
set name(String value) => jsProxy['name'] = value;

ChromeEvent onDisconnect #

ChromeEvent get onDisconnect => _createEvent(jsProxy['onDisconnect']);
set onDisconnect(ChromeEvent value) => jsProxy['onDisconnect'] = jsify(value);

ChromeEvent onMessage #

ChromeEvent get onMessage => _createEvent(jsProxy['onMessage']);
set onMessage(ChromeEvent value) => jsProxy['onMessage'] = jsify(value);

var postMessage #

dynamic get postMessage => jsProxy['postMessage'];
set postMessage(var value) => jsProxy['postMessage'] = jsify(value);

MessageSender sender #

This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners.

MessageSender get sender => _createMessageSender(jsProxy['sender']);
set sender(MessageSender value) => jsProxy['sender'] = jsify(value);

Methods

JsObject toJs() #

inherited from ChromeObject
JsObject toJs() => jsProxy;

String toString() #

inherited from ChromeObject

Returns a string representation of this object.

docs inherited from Object
String toString() => jsProxy.toString();