pull/15/head
Suvodip 2024-06-15 20:33:43 +05:30
parent 2d6dbbf2b7
commit d82e6fcb9d
1 changed files with 22 additions and 3 deletions

View File

@ -4,6 +4,23 @@ const userId = urlParams.get('userid');
const gameId = urlParams.get('id'); 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 url = window.location.href;
const gameName = url.split('/'); const gameName = url.split('/');
const gameType = gameName[3].split('?id='); const gameType = gameName[3].split('?id=');
@ -31,16 +48,18 @@ function submitUserData(drawingZone) {
let userData = { let userData = {
'gameType': gameVersion, 'gameName': gameVersion,
'gameID': gameId, 'gameID': gameId,
'screenShot': imageCode, 'screenShot': imageCode,
'userId' : userId 'userId' : userId,
'gameTime' : '10',
'score' : '100'
// 'starts': formattedDateTime, // 'starts': formattedDateTime,
// 'game_start' : gameStartTime, // 'game_start' : gameStartTime,
}; };
console.log(userData); console.log(userData);
fetch(`https://save-game-data.teachertrainingchennai.in/saveGameData`, { fetch(`http://192.168.0.166:3000/save-data`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type' : 'application/json' 'Content-Type' : 'application/json'