-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
20 lines (16 loc) · 860 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import './style.css';
import Keyboard from './public/components/keyboard/keyboard';
import KeyPressHandler from './public/components/keyboard/key-press-handler';
import Textarea from './public/components/textarea/textarea';
import Notifications from './public/components/notifications/notifications';
const app = document.createElement('div');
const keyboard = new Keyboard().render();
const textArea = new Textarea().render();
const notification = new Notifications().render();
app.setAttribute('id', 'app');
document.body.prepend(app);
app.append(textArea, keyboard, notification);
const keyPressHandler = new KeyPressHandler();
document.body.addEventListener('keydown', keyPressHandler.keyPress);
document.body.addEventListener('keyup', (evt) => keyPressHandler.keyPress(evt, false));
keyboard.addEventListener('mousedown', keyPressHandler.mousePress);