MCPcopy
hub / github.com/ampproject/amphtml / constructor

Method constructor

3p/iframe-messaging-client.js:22–40  ·  view source on GitHub ↗

* @param {!Window} win A window object. * @param {Window=} hostWindow The host window to send messages to. If not set * then we'll broadcast our messages to all parent windows and choose the * first one with a valid response to be the host window.

(win, hostWindow)

Source from the content-addressed store, hash-verified

20 * first one with a valid response to be the host window.
21 */
22 constructor(win, hostWindow) {
23 /** @private {!Window} */
24 this.win_ = win;
25 /** @private {?string} */
26 this.rtvVersion_ = getMode().rtvVersion || null;
27 /** @private {?Window} */
28 this.hostWindow_ = hostWindow || null;
29 /** @private {?string} */
30 this.sentinel_ = null;
31 /** @type {number} */
32 this.nextMessageId_ = 1;
33 /**
34 * Map messageType keys to observables to be fired when messages of that
35 * type are received.
36 * @private {!Object}
37 */
38 this.observableFor_ = map();
39 this.setupEventListener_();
40 }
41
42 /**
43 * Retrieves data from host.

Callers

nothing calls this directly

Calls 3

setupEventListener_Method · 0.95
getModeFunction · 0.90
mapFunction · 0.90

Tested by

no test coverage detected