MaterialXLab API  0.0.1
APIs For MaterialXLab Libraries
Loading...
Searching...
No Matches
IframeMessenger Class Reference

Public Member Functions

 constructor (parent, options={})
 
 post (message)
 Posts a message to the iframe.
 

Detailed Description

Definition at line 1 of file JsFrameMessenger.js.

Member Function Documentation

◆ constructor()

IframeMessenger::constructor ( parent,
options = {} )
Parameters
{string}url - The URL to load in the iframe.
{object}[options] - Optional settings: { id, parent, targetOrigin }

Definition at line 6 of file JsFrameMessenger.js.

6 {}) {
7 this.parent = parent.contentWindow
8 this.options = options;
9 }

◆ post()

IframeMessenger::post ( message)

Posts a message to the iframe.

Parameters
{string}message - The message to send.

Definition at line 15 of file JsFrameMessenger.js.

15 {
16
17 const targetOrigin = this.options.targetOrigin || '*';
18
19 console.log('> Post message to target:', targetOrigin, message);
20 this.parent.postMessage(message, targetOrigin);
21 }

The documentation for this class was generated from the following file: