vendredi 27 mars 2015

key events in atom shell

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();
});

Aucun commentaire:

Enregistrer un commentaire