add ipc and test app
This commit is contained in:
@@ -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>
|
||||
@@ -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");
|
||||
};
|
||||
Reference in New Issue
Block a user