MCPcopy Create free account
hub / github.com/ampproject/amphtml / constructor

Method constructor

testing/iframe.js:641–658  ·  view source on GitHub ↗

* @param {!Window} win

(win)

Source from the content-addressed store, hash-verified

639 * @param {!Window} win
640 */
641 constructor(win) {
642 this.events_ = [];
643 win.addEventListener('message', (event) => {
644 const parsedData = this.parseMessageData_(event.data);
645
646 if (
647 parsedData &&
648 // Either non-3P or 3P variant of the sentinel.
649 (/^amp/.test(parsedData.sentinel) ||
650 /^\d+-\d+$/.test(parsedData.sentinel))
651 ) {
652 this.events_.push({
653 data: parsedData,
654 userActivation: event.userActivation,
655 });
656 }
657 });
658 }
659
660 /**
661 * @param {string} type

Callers

nothing calls this directly

Calls 4

parseMessageData_Method · 0.95
addEventListenerMethod · 0.45
testMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected