From 344257a32228c7d425945f9f50be1d549e621e17 Mon Sep 17 00:00:00 2001 From: n loewen Date: Wed, 16 Aug 2023 12:58:51 +0100 Subject: [PATCH] Refactor: Rename `framerate` to `clockSpeed` and add jsdoc annotation --- cpu.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cpu.js b/cpu.js index 3a57d9f..3c04c19 100644 --- a/cpu.js +++ b/cpu.js @@ -298,16 +298,17 @@ async function stepCPU(debug = false) { } /** - * @param {Uint8Array} code - Machine code to run - * @param {Boolean} [debug] - Enable/disable debugging printouts + * @param {Uint8Array} code - Machine code to run + * @param {Boolean} [debug] - Enable/disable debugging printouts + * @param {Number} [clockSpeed] - CPU clock speed in milliseconds **/ -exports.runProgram = (code, debug = false, framerate = 10) => { +exports.runProgram = (code, debug = false, clockSpeed = 10) => { startCPU(code); // Animate the output by pausing between steps const loop = setInterval(async () => { stepCPU(debug); if (!CPU.running) clearInterval(loop); - }, framerate); + }, clockSpeed); }