pull/15/head
parent
2d6dbbf2b7
commit
d82e6fcb9d
|
@ -4,6 +4,23 @@ const userId = urlParams.get('userid');
|
|||
const gameId = urlParams.get('id');
|
||||
|
||||
|
||||
// Get the current time
|
||||
let startTime = new Date();
|
||||
|
||||
// Simulate some process with a delay
|
||||
setTimeout(() => {
|
||||
// Get the current time again
|
||||
let endTime = new Date();
|
||||
|
||||
// Calculate the difference in milliseconds
|
||||
let timeDifference = endTime - startTime;
|
||||
|
||||
// Convert milliseconds to seconds
|
||||
let timeDifferenceInSeconds = timeDifference / 1000;
|
||||
|
||||
console.log(`Time difference: ${timeDifferenceInSeconds} seconds`);
|
||||
}, 3000); // 3-second delay
|
||||
|
||||
const url = window.location.href;
|
||||
const gameName = url.split('/');
|
||||
const gameType = gameName[3].split('?id=');
|
||||
|
@ -31,16 +48,18 @@ function submitUserData(drawingZone) {
|
|||
|
||||
|
||||
let userData = {
|
||||
'gameType': gameVersion,
|
||||
'gameName': gameVersion,
|
||||
'gameID': gameId,
|
||||
'screenShot': imageCode,
|
||||
'userId' : userId
|
||||
'userId' : userId,
|
||||
'gameTime' : '10',
|
||||
'score' : '100'
|
||||
// 'starts': formattedDateTime,
|
||||
// 'game_start' : gameStartTime,
|
||||
};
|
||||
console.log(userData);
|
||||
|
||||
fetch(`https://save-game-data.teachertrainingchennai.in/saveGameData`, {
|
||||
fetch(`http://192.168.0.166:3000/save-data`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type' : 'application/json'
|
||||
|
|
Loading…
Reference in New Issue