diff --git a/package.json b/package.json index 3f073ce59c..ee4094601a 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "linkifyjs": "^2.1.9", "lodash": "^4.17.19", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", - "matrix-widget-api": "^0.1.0-beta.3", + "matrix-widget-api": "^0.1.0-beta.5", "minimist": "^1.2.5", "pako": "^1.0.11", "parse5": "^5.1.1", diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index d0a19285dd..17302d0ab9 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -253,9 +253,9 @@ export class StopGapWidget extends EventEmitter { if (this.started) return; const driver = new StopGapWidgetDriver( this.appTileProps.whitelistCapabilities || []); this.messaging = new ClientWidgetApi(this.mockWidget, iframe, driver); - this.messaging.addEventListener("preparing", () => this.emit("preparing")); - this.messaging.addEventListener("ready", () => this.emit("ready")); - this.messaging.addEventListener(`action:${WidgetApiFromWidgetAction.GetOpenIDCredentials}`, this.onOpenIdReq); + this.messaging.on("preparing", () => this.emit("preparing")); + this.messaging.on("ready", () => this.emit("ready")); + this.messaging.on(`action:${WidgetApiFromWidgetAction.GetOpenIDCredentials}`, this.onOpenIdReq); WidgetMessagingStore.instance.storeMessaging(this.mockWidget, this.messaging); if (!this.appTileProps.userWidget && this.appTileProps.room) { @@ -263,7 +263,7 @@ export class StopGapWidget extends EventEmitter { } if (WidgetType.JITSI.matches(this.mockWidget.type)) { - this.messaging.addEventListener("action:set_always_on_screen", + this.messaging.on("action:set_always_on_screen", (ev: CustomEvent) => { if (this.messaging.hasCapability(MatrixCapabilities.AlwaysOnScreen)) { ActiveWidgetStore.setWidgetPersistence(this.mockWidget.id, ev.detail.data.value); @@ -273,7 +273,7 @@ export class StopGapWidget extends EventEmitter { }, ); } else if (WidgetType.STICKERPICKER.matches(this.mockWidget.type)) { - this.messaging.addEventListener(`action:${ElementWidgetActions.OpenIntegrationManager}`, + this.messaging.on(`action:${ElementWidgetActions.OpenIntegrationManager}`, (ev: CustomEvent) => { // Acknowledge first ev.preventDefault(); @@ -307,7 +307,7 @@ export class StopGapWidget extends EventEmitter { // TODO: Replace this event listener with appropriate driver functionality once the API // establishes a sane way to send events back and forth. - this.messaging.addEventListener(`action:${WidgetApiFromWidgetAction.SendSticker}`, + this.messaging.on(`action:${WidgetApiFromWidgetAction.SendSticker}`, (ev: CustomEvent) => { // Acknowledge first ev.preventDefault(); diff --git a/yarn.lock b/yarn.lock index 1f06fd6130..a06e8bc62d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4155,6 +4155,11 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== +events@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.2.0.tgz#93b87c18f8efcd4202a461aec4dfc0556b639379" + integrity sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg== + except@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/except/-/except-0.1.3.tgz#98261c91958551536b44482238e9783fb73d292a" @@ -6527,10 +6532,12 @@ matrix-react-test-utils@^0.2.2: resolved "https://registry.yarnpkg.com/matrix-react-test-utils/-/matrix-react-test-utils-0.2.2.tgz#c87144d3b910c7edc544a6699d13c7c2bf02f853" integrity sha512-49+7gfV6smvBIVbeloql+37IeWMTD+fiywalwCqk8Dnz53zAFjKSltB3rmWHso1uecLtQEcPtCijfhzcLXAxTQ== -matrix-widget-api@^0.1.0-beta.3: - version "0.1.0-beta.3" - resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.3.tgz#356965ca357172ee056e3fd86fd96879b059a114" - integrity sha512-j7nxdhLQfdU6snsdBA29KQR0DmT8/vl6otOvGqPCV0OCHpq1312cP79Eg4JzJKIFI3A76Qha3nYx6G9/aapwXg== +matrix-widget-api@^0.1.0-beta.5: + version "0.1.0-beta.5" + resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.5.tgz#dd7f24a177aa590d812bd4e92e2c3ac225c5557e" + integrity sha512-J3GBJtVMFuEM/EWFylc0IlkPjdgmWxrkGYPaZ0LSmxp+OlNJxYfnWPR6F6HveW+Z8C1i0vq+BTueofSqKv2zDg== + dependencies: + events "^3.2.0" mdast-util-compact@^1.0.0: version "1.0.4"