Let's say I want to have a key event only on my compiled application with atom shell.
var app = require('app');
var BrowserWindow = require('browser-window');
require('crash-reporter').start();
app.on('ready', function() {
win = new BrowserWindow({ fullscreen: true, frame: false });
win.hide();
win.loadUrl("http://localhost:3000");
win.webContents.on('did-finish-load', function() {
win.show();
win.focus();
});
process.on('uncaughtException', app.quit);
});
How could I bind a keyboard event on the web browser? Eg,
win.on('keypress', 'left-arrow', function() {
win.webContents.goBack();
});
Also, apparently left arrow fires on key down, not key press. Credit: Detecting arrow key presses in JavaScript
I'm just learning about atom-shell, but couldn't you catch the keypress inside your UI (I think it's called the rendererer process), like you would in a typical web page, then use the remote() API to call back to the renderer process and do whatever logic you wanted?