Adding an API for inter-iframe communication

Adds a first version of an API to communicate between an iFrame opened by WorkAdventure and WorkAdventure itself.
The first API method is a method allowing to add messages in the chat, from the iFrame.

Comes with a test file.
This commit is contained in:
David Négrier 2021-03-04 19:00:00 +01:00
parent bf8e8bf777
commit eb93a04341
8 changed files with 184 additions and 4 deletions

17
maps/tests/iframe.html Normal file
View file

@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<script src="http://play.workadventure.localhost/iframe_api.js"></script>
<script>
</script>
</head>
<body>
<button id="sendchat">Send chat message</button>
<script>
document.getElementById('sendchat').onclick = () => {
WA.sendChatMessage('Hello world!', 'Mr Robot');
}
</script>
</body>
</html>