From 0fdef23e37759a6fe2fd56da831e4c452b0f9c00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sun, 20 Nov 2022 02:52:59 +0000
Subject: [PATCH] reactor: better code layout

---
 frontends/web/ts/gb.ts | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/frontends/web/ts/gb.ts b/frontends/web/ts/gb.ts
index aed272d6..d39468ac 100644
--- a/frontends/web/ts/gb.ts
+++ b/frontends/web/ts/gb.ts
@@ -1,4 +1,5 @@
 import {
+    BenchmarkResult,
     Emulator,
     EmulatorBase,
     Entry,
@@ -488,10 +489,6 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
         this.updatePalette();
     }
 
-    getTile(index: number): Uint8Array {
-        return this.gameBoy?.get_tile_buffer(index) ?? new Uint8Array();
-    }
-
     toggleRunning() {
         if (this.paused) {
             this.resume();
@@ -525,14 +522,18 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
         this.gameBoy?.key_lift(keyCode);
     }
 
-    changePalette() {
+    getTile(index: number): Uint8Array {
+        return this.gameBoy?.get_tile_buffer(index) ?? new Uint8Array();
+    }
+
+    changePalette(): string {
         this.paletteIndex += 1;
         this.paletteIndex %= PALETTES.length;
         this.updatePalette();
         return PALETTES[this.paletteIndex].name;
     }
 
-    benchmark(count = 50000000) {
+    benchmark(count = 50000000): BenchmarkResult {
         let cycles = 0;
         this.pause();
         try {
-- 
GitLab