Skip to content

Instantly share code, notes, and snippets.

@Paratron
Created July 1, 2012 10:05
Show Gist options
  • Save Paratron/3027785 to your computer and use it in GitHub Desktop.
Save Paratron/3027785 to your computer and use it in GitHub Desktop.
Suggestion for basic AppJS structure.
//Previously, you first required appjs, then called appjs.init(), which returns an app object. We can merge that into just one step.
var app = require('appjs');
//This is the basic way to call a window. You pass either a string with the URL of the window content, or you pass a full object, if you want to set more options.
var main_window = app.createWindow({
url: 'http://appjs/main.html',
width: 640,
height: 480,
maximizable: false
});
//Window specific events will be emitted by the window object itself, instead of the app object.
main_window.on('ready', function(){
main_window.show();
});
//Main window closed - terminate the application
main_window.on('close', function(){
app.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment