mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-03 20:36:57 +03:00
Set widget ID on WidgetMessaging instance.
This commit is contained in:
parent
7660176079
commit
a408b98504
2 changed files with 4 additions and 3 deletions
|
@ -170,8 +170,9 @@ if (!global.mxWidgetMessagingMessageEndpoints) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class WidgetMessaging extends MatrixPostMessageApi {
|
export default class WidgetMessaging extends MatrixPostMessageApi {
|
||||||
constructor(targetWindow) {
|
constructor(widgetId, targetWindow) {
|
||||||
super(targetWindow);
|
super(targetWindow);
|
||||||
|
this.widgetId = widgetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(action) {
|
exec(action) {
|
||||||
|
|
|
@ -334,11 +334,11 @@ export default React.createClass({
|
||||||
*/
|
*/
|
||||||
_onLoaded() {
|
_onLoaded() {
|
||||||
// console.warn("App frame", this.refs.appFrame.contentWindow);
|
// console.warn("App frame", this.refs.appFrame.contentWindow);
|
||||||
this.widgetMessaging = new WidgetMessaging(this.refs.appFrame.contentWindow);
|
this.widgetMessaging = new WidgetMessaging(this.props.id, this.refs.appFrame.contentWindow);
|
||||||
this.widgetMessaging.startListening();
|
this.widgetMessaging.startListening();
|
||||||
this.widgetMessaging.addEndpoint(this.props.id, this.props.url);
|
this.widgetMessaging.addEndpoint(this.props.id, this.props.url);
|
||||||
this.widgetMessaging.getCapabilities().then((capabilities) => {
|
this.widgetMessaging.getCapabilities().then((capabilities) => {
|
||||||
console.log("Got widget capabilities", this.widgetId, capabilities);
|
console.log("Got widget capabilities", this.props.id, capabilities);
|
||||||
capabilities = capabilities || [];
|
capabilities = capabilities || [];
|
||||||
this.setState({capabilities});
|
this.setState({capabilities});
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
|
Loading…
Reference in a new issue