18 lines
593 B
TypeScript
18 lines
593 B
TypeScript
import { getContextItem } from "./lib/context.ts";
|
|
import { InputManager } from "./lib/input.ts";
|
|
import { StateMachine } from "./state/machine.ts";
|
|
import { States } from "./state/states/index.ts";
|
|
|
|
export function bootstrapInputs() {
|
|
const inputManager = getContextItem<InputManager>("inputManager");
|
|
inputManager.onKey("e", () => {
|
|
const state = getContextItem<StateMachine<States>>("state");
|
|
state.transitionTo(States.EDIT_TRACK);
|
|
});
|
|
inputManager.onKey("Delete", () => {
|
|
if (inputManager.getKeyState("Control")) {
|
|
localStorage.removeItem("track");
|
|
}
|
|
});
|
|
}
|