portchannel.js
No description.

File Location

/goog/messaging/portchannel.js

Classes

goog.messaging.PortChannel
A wrapper for several types of HTML5 message-passing entities ( MessagePorts and WebWorkers). This class implements the goog.messaging.MessageChannel interface. This class can be used in conjunction with other communication on the port. It sets goog.messaging.PortChannel.FLAG to true on all messages it sends.

Public Protected Private

Global Functions

goog.messaging.PortChannel.forEmbeddedWindow&disposeTimer()
No description.
code »
goog.messaging.PortChannel.forEmbeddedWindow(windowpeerOriginopt_timer) !goog.messaging.DeferredChannel
Create a PortChannel that communicates with a window embedded in the current page (e.g. an iframe contentWindow). The code within the window should call forGlobalWindow to establish the connection. It's possible to use this channel in conjunction with other messages to the embedded window. However, only one PortChannel should be used for a given window at a time.
Arguments:
window : !Window
The window object to communicate with.
peerOrigin : string
The expected origin of the window. See http://dev.w3.org/html5/postmsg/#dom-window-postmessage.
opt_timer : goog.Timer=
The timer that regulates how often the initial connection message is attempted. This will be automatically disposed once the connection is established, or when the connection is cancelled.
Returns: !goog.messaging.DeferredChannel  The PortChannel. Although this is not actually an instance of the PortChannel class, it will behave like one in that MessagePorts may be sent across it. The DeferredChannel may be cancelled before a connection is established in order to abort the attempt to make a connection.
code »
goog.messaging.PortChannel.forGlobalWindow(peerOrigin) !goog.messaging.MessageChannel
Create a PortChannel that communicates with the document in which this window is embedded (e.g. within an iframe). The enclosing document should call forEmbeddedWindow to establish the connection. It's possible to use this channel in conjunction with other messages posted to the global window. However, only one PortChannel should be used for the global window at a time.
Arguments:
peerOrigin : string
The expected origin of the enclosing document. See http://dev.w3.org/html5/postmsg/#dom-window-postmessage.
Returns: !goog.messaging.MessageChannel  The PortChannel. Although this may not actually be an instance of the PortChannel class, it will behave like one in that MessagePorts may be sent across it.
code »
goog.messaging.PortChannel.forEmbeddedWindow&function%0&gotMessage()
No description.
code »

Directory messaging

File Reference