Skip to content

Instantly share code, notes, and snippets.

@piscis
Created October 5, 2012 09:54
Show Gist options
  • Save piscis/3839018 to your computer and use it in GitHub Desktop.
Save piscis/3839018 to your computer and use it in GitHub Desktop.
Create a fullscreen window
var appjs = require('appjs');
// serve static files from a directory
appjs.serveFilesFrom(__dirname + '/content');
// handle requests from the browser
appjs.router.post('/', function(request, response, next){
response.send('Hey! How are you ' + request.post('firstname'));
})
// create a window
var window = appjs.createWindow({
//width: 640,
//height: 460,
alpha: false,
fullscreen: true,
//autoResize: true,
showChrome: false,
disableSecurity: true,
});
// prepare the window when first created
window.on('create', function(){
console.log("Window Created");
// window.frame controls the desktop window
window.frame.show().center();
});
// the window is ready when the DOM is loaded
window.on('ready', function(){
console.log("Window Ready");
// directly interact with the DOM
window.process = process;
window.module = module;
window.addEventListener('keydown', function(e){
// show chrome devtools on f12 or commmand+option+j
if (e.keyIdentifier === 'F12' || e.keyCode === 74 && e.metaKey && e.altKey) {
window.frame.openDevTools();
}
});
});
// cleanup code when window is closed
window.on('close', function(){
console.log("Window Closed");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment