Fix test Scripting API (#1298)
* fix tests of Scripting API * Suppression ts-ignore
This commit is contained in:
parent
78524e64bd
commit
4f513fb1e0
7 changed files with 92 additions and 60 deletions
|
@ -1,15 +1,22 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<script src="http://play.workadventure.localhost/iframe_api.js"></script>
|
||||
<script>
|
||||
var script = document.createElement('script');
|
||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
||||
document.head.appendChild(script);
|
||||
window.addEventListener('load', () => {
|
||||
WA.player.getCurrentUser().then((user) => {
|
||||
console.log('id : ', user.id);
|
||||
console.log('nickName : ', user.nickName);
|
||||
console.log('tags : ', user.tags);
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
WA.player.getCurrentUser().then((user) => {
|
||||
console.log('id : ', user.id);
|
||||
console.log('nickName : ', user.nickName);
|
||||
console.log('tags : ', user.tags);
|
||||
})
|
||||
</script>
|
||||
<p>Log in the console the information of the current player</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue