add ipc and test app

This commit is contained in:
Anton Bracke
2022-02-17 19:48:08 +01:00
parent 31a0d7d452
commit a11d19a457
8 changed files with 91 additions and 12 deletions
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WorkAdventure Desktop Demo</title>
</head>
<body>
<div id="demo">Hello World!</div>
<button id="btn-reload">Refresh</button>
<button id="btn-api">Call api</button>
<script src="./web.js" lang="javascript"></script>
</body>
</html>
+25
View File
@@ -0,0 +1,25 @@
let muted = false;
if (window?.WorkAdventureDesktopApi?.desktop) {
document.getElementById("demo").innerHTML =
"Hello Desktop app! Press ctrl-alt-m to mute.";
window?.WorkAdventureDesktopApi?.onMutedKeyPress((event) => {
if (muted) {
document.getElementById("demo").innerHTML =
"Ready to speak! Press ctrl-alt-m to mute.";
} else {
document.getElementById("demo").innerHTML =
"Muted! Press ctrl-alt-m to unmute again.";
}
muted = !muted;
});
}
document.getElementById("btn-reload").onclick = () => {
location.reload();
};
document.getElementById("btn-api").onclick = () => {
window.WorkAdventureDesktopApi.notify("Hello from website");
};