Periodically pass messages to embedded iframe

pull/21833/head
Richard Lewis 2017-06-04 23:00:52 +01:00
parent dac154f828
commit c6991fd33c
1 changed files with 11 additions and 1 deletions

View File

@ -33,6 +33,16 @@ export default React.createClass({
};
},
componentDidMount: function() {
console.log("App component %s mounted", this.props.id);
setInterval(() => {
const msg = "Message from riot";
const domain = 'http://localhost:8000';
this.refs.appFrame.contentWindow.postMessage(msg, domain);
console.log("Sending message");
}, 3000);
},
_onEditClick: function() {
console.log("Edit widget %s", this.props.id);
},
@ -65,7 +75,7 @@ export default React.createClass({
</div>
<div className="mx_AppTileBody">
{/* <iframe sandbox="sandbox" seamless="seamless" src={this.props.url}></iframe> */}
<iframe seamless="seamless" src={this.props.url}></iframe>
<iframe ref="appFrame" seamless="seamless" src={this.props.url}></iframe>
</div>
</div>
);