mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-12 18:34:05 +08:00
move stuff around
This commit is contained in:
parent
8169bfd385
commit
396b95e48b
5 changed files with 22 additions and 19 deletions
13
frontend/src/ts/signals/config.ts
Normal file
13
frontend/src/ts/signals/config.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { createSignal } from "solid-js";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
import config from "../config";
|
||||
|
||||
export const [getLiveSpeedStyle, setLifeSpeedStype] = createSignal(
|
||||
config.liveSpeedStyle,
|
||||
);
|
||||
|
||||
ConfigEvent.subscribe(({ key, newValue }) => {
|
||||
if (key === "liveSpeedStyle") {
|
||||
setLifeSpeedStype(newValue);
|
||||
}
|
||||
});
|
||||
4
frontend/src/ts/signals/live-states.ts
Normal file
4
frontend/src/ts/signals/live-states.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { createSignal } from "solid-js";
|
||||
export const [getWpm, setWpm] = createSignal("0");
|
||||
export const [getAcc, setAcc] = createSignal(0);
|
||||
export const [getBurst, setBurst] = createSignal(0);
|
||||
|
|
@ -1,17 +1,9 @@
|
|||
import { createMemo, createSignal } from "solid-js";
|
||||
import { createMemo } from "solid-js";
|
||||
import { qsr } from "../utils/dom";
|
||||
import { LiveCounter } from "./live-counter";
|
||||
import { render } from "solid-js/web";
|
||||
import config from "../config";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
|
||||
export const [getWpm, setWpm] = createSignal("0");
|
||||
export const [getAcc, setAcc] = createSignal(0);
|
||||
export const [getBurst, setBurst] = createSignal(0);
|
||||
|
||||
const [getLiveSpeedStyle, setLifeSpeedStype] = createSignal(
|
||||
config.liveSpeedStyle,
|
||||
);
|
||||
import { getWpm } from "../signals/live-states";
|
||||
import { getLiveSpeedStyle } from "../signals/config";
|
||||
|
||||
const liveWpm = createMemo(() => {
|
||||
return getLiveSpeedStyle() !== "off" ? getWpm() : "";
|
||||
|
|
@ -23,9 +15,3 @@ export function mountLiveCounters(): void {
|
|||
qsr("#liveSpeedCounter").native,
|
||||
);
|
||||
}
|
||||
|
||||
ConfigEvent.subscribe(({ key, newValue }) => {
|
||||
if (key === "liveSpeedStyle") {
|
||||
setLifeSpeedStype(newValue);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import * as SoundController from "../controllers/sound-controller";
|
|||
import { clearLowFpsMode, setLowFpsMode } from "../anim";
|
||||
import { createTimer } from "animejs";
|
||||
import { requestDebouncedAnimationFrame } from "../utils/debounced-animation-frame";
|
||||
import { setWpm } from "./live-states";
|
||||
import { setWpm } from "../signals/live-states";
|
||||
import Format from "../utils/format";
|
||||
|
||||
let lastLoop = 0;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ import * as ModesNotice from "../elements/modes-notice";
|
|||
import * as Last10Average from "../elements/last-10-average";
|
||||
import * as MemoryFunboxTimer from "./funbox/memory-funbox-timer";
|
||||
import { qsr } from "../utils/dom";
|
||||
import { setWpm } from "./live-states";
|
||||
import { setWpm } from "../signals/live-states";
|
||||
|
||||
export const updateHintsPositionDebounced = Misc.debounceUntilResolved(
|
||||
updateHintsPosition,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue