1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-13 08:02:38 +03:00

Factor out cloning to a util and use it everywhere

This commit is contained in:
Travis Ralston
2020-06-22 14:14:43 -06:00
parent 9e3c101172
commit 1fe3e33dbf
9 changed files with 29 additions and 13 deletions

View File

@@ -19,6 +19,7 @@ limitations under the License.
import { randomString } from "matrix-js-sdk/src/randomstring";
import { EventEmitter } from "events";
import { objectClone } from "../utils/objects";
export enum Capability {
Screenshot = "m.capability.screenshot",
@@ -140,7 +141,7 @@ export class WidgetApi extends EventEmitter {
private replyToRequest(payload: ToWidgetRequest, reply: any) {
if (!window.parent) return;
const request = JSON.parse(JSON.stringify(payload));
const request = objectClone(payload);
request.response = reply;
window.parent.postMessage(request, this.origin);