Skip to content

Commit

Permalink
[Update]2048 url로 데이터 받기 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
ChungO5 committed Jan 22, 2024
1 parent 7b56116 commit 11873af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion game-server/src/main/resources/static/2048.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<td id="33"></td>
</tr>
</table>
<p id="receivedData" style="display: none"></p>
<!-- <p id="receivedData" style="display: none"></p> -->
</div>
</body>
<script type="text/javascript" src="2048.js"></script>
Expand Down
13 changes: 8 additions & 5 deletions game-server/src/main/resources/static/2048.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ var tableID = Array(
Array("30", "31", "32", "33")
);
var score;
var userId = null;
window.addEventListener("message", function (event) {
document.getElementById("receivedData").textContent = event.data;
userId = event.data;
});
// var userId = null;
// window.addEventListener("message", function (event) {
// document.getElementById("receivedData").textContent = event.data;
// userId = event.data;
// });

const urlParams = new URLSearchParams(window.location.search);
var userId = urlParams.get("userId");

// 키보드 입력 처리
document.onkeydown = keyDownEventHandler;
Expand Down

0 comments on commit 11873af

Please sign in to comment.