Skip to content

Commit

Permalink
Fix issue with Electron build
Browse files Browse the repository at this point in the history
  • Loading branch information
nicross committed Jun 13, 2021
1 parent 59c808f commit 7d92cf6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/TODO.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO
- Improve train link collision detection
- Improve offensive AI
- Fix escape key not working within Electorn while in-game
22 changes: 22 additions & 0 deletions src/js/app/utility/escape.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
app.utility.escape = (() => {
const pubsub = engine.utility.pubsub.create()
let state = false

window.addEventListener('keydown', (e) => {
if (e.code == 'Escape') {
pubsub.emit('down')
state = true
}
})

window.addEventListener('keyup', (e) => {
if (e.code == 'Escape') {
pubsub.emit('up')
state = false
}
})

return engine.utility.pubsub.decorate({
is: () => state,
}, pubsub)
})()

0 comments on commit 7d92cf6

Please sign in to comment.