Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbserverprogrammering/projekt/GYA-Teo-Kit/js/

box.js
branch_box_1.js
branch_gate.js
branch_main_1.js
branch_main_2.js
branch_player_1.js
door.js
gate.js
global.js
imagesNSound_handler.js
main.js
player.js
pressure_plate.js
rolling_stone.js
saveInputs.js
world.js

saveInputs.js

20 lines ASCII Windows (CRLF)
document.addEventListener("keydown", down);
document.addEventListener("keyup", up);
let actions = {};
let startTime = Date.now();


document.getElementById("actions").value = "";
document.getElementById("time").value = startTime;

function down(key) {
  actions[Date.now() - startTime] = key.key;
  document.getElementById("actions").value += Date.now() - startTime + " " + key.keyCode + " keydown" + ",";
  console.log(document.getElementById("actions").value);
}

function up(key) {
  actions[Date.now() - startTime] = key.key;
  document.getElementById("actions").value += Date.now() - startTime + " " + key.keyCode + " keyup" + ",";
  console.log(document.getElementById("actions").value);
}