Preventing a loop from occuring with chat API

When sending a chat message from the Scripting API, the chat message is no longer sent back to the chat listener.
This makes it easier to avoid infinite loops.
This commit is contained in:
David Négrier 2022-04-26 14:42:08 +02:00
parent 5479aea9f0
commit 5834b7e8c6

View File

@ -404,12 +404,15 @@ class IframeListener {
* @param exceptOrigin Don't dispatch the message to exceptOrigin (to avoid infinite loops) * @param exceptOrigin Don't dispatch the message to exceptOrigin (to avoid infinite loops)
*/ */
sendUserInputChat(message: string, exceptOrigin?: Window) { sendUserInputChat(message: string, exceptOrigin?: Window) {
this.postMessage({ this.postMessage(
type: "userInputChat", {
data: { type: "userInputChat",
message: message, data: {
} as UserInputChatEvent, message: message,
}, exceptOrigin); } as UserInputChatEvent,
},
exceptOrigin
);
} }
sendEnterEvent(name: string) { sendEnterEvent(name: string) {