]> git.r.bdr.sh - rbdr/blog/blob - static/js/blog.js
68c13dacbeb1d35be9f94884a2f3d4ce9d492f75
[rbdr/blog] / static / js / blog.js
1 'use strict';
2
3 /* globals window */
4
5 ((w) => {
6
7 const internals = {
8 // Application entry point, for now just band to keyboard
9
10 main() {
11
12 w.document.addEventListener('keydown', internals._onKeyDown);
13 },
14
15 // Handles key events to point to the correct blog post.
16
17 _onKeyDown(e) {
18
19 if (['1','2','3'].indexOf(e.key) > -1) {
20 w.location.hash = e.key;
21 }
22 }
23 };
24
25 w.addEventListener('load', internals.main);
26 })(window);