Skip to content

Commit e413755

Browse files
committed
💅 use const for top-level constants in demos
1 parent feaa5c2 commit e413755

2 files changed

Lines changed: 27 additions & 27 deletions

File tree

demo/inline-region.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ import {
2828
import { cursor, settings } from "../settings.ts";
2929
import { validated } from "../validate.ts";
3030

31-
let encode = (s: string) => new TextEncoder().encode(s);
32-
let write = (b: Uint8Array) => Deno.stdout.writeSync(b);
33-
34-
let GREEN = rgba(80, 250, 123);
35-
let GRAY = rgba(100, 100, 100);
36-
let CYAN = rgba(139, 233, 253);
37-
38-
let RED = rgba(255, 0, 0);
39-
let ORANGE = rgba(255, 153, 0);
40-
let YELLOW = rgba(255, 255, 0);
41-
let NGREEN = rgba(51, 255, 0);
42-
let BLUE = rgba(0, 153, 255);
43-
let VIOLET = rgba(102, 0, 255);
44-
let RAINBOW = [RED, ORANGE, YELLOW, NGREEN, BLUE, VIOLET];
45-
46-
let BRAILLE = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
31+
const encode = (s: string) => new TextEncoder().encode(s);
32+
const write = (b: Uint8Array) => Deno.stdout.writeSync(b);
33+
34+
const GREEN = rgba(80, 250, 123);
35+
const GRAY = rgba(100, 100, 100);
36+
const CYAN = rgba(139, 233, 253);
37+
38+
const RED = rgba(255, 0, 0);
39+
const ORANGE = rgba(255, 153, 0);
40+
const YELLOW = rgba(255, 255, 0);
41+
const NGREEN = rgba(51, 255, 0);
42+
const BLUE = rgba(0, 153, 255);
43+
const VIOLET = rgba(102, 0, 255);
44+
const RAINBOW = [RED, ORANGE, YELLOW, NGREEN, BLUE, VIOLET];
45+
46+
const BRAILLE = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
4747

4848
function* queryCursor(): Operation<CursorEvent> {
4949
let parser = yield* until(createInput({ escLatency: 100 }));

demo/keyboard.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ import {
3333
import { useInput } from "./use-input.ts";
3434
import { useStdin } from "./use-stdin.ts";
3535

36-
let active = rgba(60, 120, 220);
37-
let inactive = rgba(50, 50, 60);
38-
let on = rgba(40, 180, 80);
39-
let label = rgba(220, 220, 220);
40-
let dim = rgba(100, 100, 120);
41-
let highlight = rgba(255, 220, 80);
36+
const active = rgba(60, 120, 220);
37+
const inactive = rgba(50, 50, 60);
38+
const on = rgba(40, 180, 80);
39+
const label = rgba(220, 220, 220);
40+
const dim = rgba(100, 100, 120);
41+
const highlight = rgba(255, 220, 80);
4242

43-
let KEY_W = 5;
44-
let GAP = 1;
43+
const KEY_W = 5;
44+
const GAP = 1;
4545

4646
interface KeyDef {
4747
label: string;
@@ -58,7 +58,7 @@ function matches(k: KeyDef, event: InputEvent | PointerEvent): boolean {
5858
event.code.toUpperCase() === k.code.toUpperCase();
5959
}
6060

61-
let hovered = rgba(80, 80, 100);
61+
const hovered = rgba(80, 80, 100);
6262

6363
function key(ops: Op[], k: KeyDef, ctx: AppContext): void {
6464
let pressed = ctx.event && matches(k, ctx.event);
@@ -328,7 +328,7 @@ function toggle(ops: Op[], enabled: boolean, name: string): void {
328328
);
329329
}
330330

331-
let flagNames:
331+
const flagNames:
332332
(keyof Omit<AppContext, "mode" | "event" | "logged" | "log" | "entered">)[] =
333333
[
334334
"Disambiguate escape codes",
@@ -338,7 +338,7 @@ let flagNames:
338338
"Report associated text",
339339
];
340340

341-
let logEntries: { key: string; name: keyof EventFilter }[] = [
341+
const logEntries: { key: string; name: keyof EventFilter }[] = [
342342
{ key: "a", name: "keydown" },
343343
{ key: "b", name: "keyup" },
344344
{ key: "c", name: "keyrepeat" },

0 commit comments

Comments
 (0)