From ab3dedf3b8d7b36070f121a691d91b4a6a7c0828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Mon, 20 Jun 2022 01:05:33 +0100 Subject: [PATCH] refactor: cleanup spaces --- examples/web/index.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/web/index.js b/examples/web/index.js index 10ee28d..07fc409 100644 --- a/examples/web/index.js +++ b/examples/web/index.js @@ -75,14 +75,14 @@ const state = { // runs the sequence as an infinite loop, running // the associated CPU cycles accordingly - while (true) { + while (true) { const ratioLogic = state.logicFrequency / VISUAL_HZ; - for(let i = 0; i < ratioLogic; i++) { + for (let i = 0; i < ratioLogic; i++) { state.chip8.clock_ws(); } const ratioTimer = TIMER_HZ / VISUAL_HZ; - for(let i = 0; i < ratioTimer; i++) { + for (let i = 0; i < ratioTimer; i++) { state.chip8.clock_dt_ws(); state.chip8.clock_st_ws(); } @@ -90,9 +90,9 @@ const state = { // updates the canvas object with the new // visual information coming in updateCanvas(state.chip8.vram_ws()); - + // waits a little bit for the next frame to be draw - // @todo need to define target time for draw + // @todo NEED TO DEFINE A TARGET TIME await new Promise((resolve, reject) => { setTimeout(resolve, 1000 / VISUAL_HZ); }); @@ -128,7 +128,7 @@ const registerDrop = () => { state.chip8.reset_hard_ws(); state.chip8.load_rom_ws(data); - + setRom(file.name, file.size); showToast(`Loaded ${file.name} ROM successfully!`); @@ -161,8 +161,7 @@ const registerKeys = () => { return; } - - switch(event.key) { + switch (event.key) { case "+": setLogicFrequency(state.logicFrequency + 60); break; @@ -287,4 +286,4 @@ const updateCanvas = (pixels) => { } state.canvasCtx.putImageData(state.image, 0, 0); state.canvasScaledCtx.drawImage(state.canvas, 0, 0); -}; +}; \ No newline at end of file -- GitLab