class Keyboard {
	private keys = new Map();

	constructor() {
		document.addEventListener('keydown', (e) => this.keys.set(e.code, true));
		document.addEventListener('keyup', (e) => this.keys.set(e.code, false));
	}

	isPressed(code: string): boolean {
		return this.keys.get(code) === true;
	}
}

export default Keyboard;
